Sathya Narayan

Sathya Narayan

  • NA
  • 155
  • 63.8k

Fetch The Value to textbox from one form to another form

Mar 17 2014 7:41 AM
hi ,

I need to fetch the values to textbox from one form to another .

This is my code

Private Sub display()
        connection = New SqlConnection(con)
        Dim Sql As String = "SELECT ID,Name from tblTickets where stu='A' order by Name"
        da1 = New SqlDataAdapter(Sql, connection)
        'conn.Open()
        ds1 = New DataSet()
        Dim commandBuilder1 As SqlCommandBuilder = New SqlCommandBuilder(da1)
        da1.Fill(ds1, "Pub")
        dsource1.DataSource = ds1.Tables("Pub")
        connection.Close()
        DataGridView3.DataSource = dsource1
        DataGridView3.Refresh()

        DataGridView3.Columns(0).Width = 100
        DataGridView3.Columns(1).Width = 200
    End Sub


Private Sub DataGridView3_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView3.CellContentClick



        i = DataGridView3.CurrentRow.Index
        Dim dgv As DataGridView = CType(sender, DataGridView)
        Dim thisCell As DataGridViewCell = dgv.SelectedCells(0)
        Dim selCell As Integer = thisCell.ColumnIndex
        Dim sch As New Schedules
        sch.txtID.Text = DataGridView3.Item(0, i).Value.ToString()
        'Form1.txtflight.Text = DataGridView3.Item(1, i).Value.ToString
        Me.Dispose()
    End Sub








Answers (8)