move data from form to another

hawk

Member
Joined
Sep 6, 2008
Messages
8
Programming Experience
Beginner
hello folks,

I have a form which using mysql connector display the results I'm looking for but I need to be able to double click on a row and the information in that row put into another form. Any guidance, tips, help you guys can provide would be much appreciated.

As always, thanks

VB.NET:
    Private Sub refreshStatus(ByRef statusView As DataGridView)



        Dim conn As New MySqlConnection
        Dim myCommand As New MySqlCommand
        Dim myAdapter As New MySqlDataAdapter
        Dim myData As New DataTable
        Dim SQL As String

        SQL = "SELECT * FROM pilots ORDER by pilot_num"

        conn = New MySqlConnection()
        conn.ConnectionString = "server=; user id=; password=; database="


        Try
            conn.Open()

            Try
                myCommand.Connection = conn
                myCommand.CommandText = SQL

                myAdapter.SelectCommand = myCommand
                myAdapter.Fill(myData)

                dgvstatus.DataSource = myData
                dgvstatus.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells
            Catch myerror As MySqlException
                MsgBox("There was an error reading from the database: " & myerror.Message)
            End Try
        Catch myerror As MySqlException
            MessageBox.Show("Error connecting to the database: " & myerror.Message)
        Finally
            If conn.State <> ConnectionState.Closed Then conn.Close()
        End Try

    End Sub
 
Last edited:
One option, you could declare the datatable in a module file so that both forms can see it. Or store it in a new DataRow and either pass it back and forth.
 

Latest posts

Back
Top