How to use an object to travel data from one form to another

Posted by Ehteshamsiddiqui under VB.NET on 9/7/2011 | Points: 10 | Views : 1147 | Status : [Member] | Replies : 0
I have two forms.Both having DatagridView.There are two comboboxes to filter the record from Database and fill in Datagridview.My requirement is when all the data is populated in DataGrid after selecting the comboboxes and when the user clicks on Delete.
The comboboxes and Datagrid on second form should have the same values as that was on first form.The names of my Comboboxes and Datagridview are same on both the forms
Below is the code my Datagrid view getting populated in First Form.
Sub GetData(ByVal StrQuery As String)
If CBMedium.Text <> "" And CBClass.Text <> "" Then
con = DBConnect()
cmd = New SqlCommand(StrQuery, con)
dr = cmd.ExecuteReader
If dr.HasRows Then
While dr.Read

DGVStudRecord.Rows.Add(dr(0), dr(1), dr(2), dr(3), dr(4), dr(5))
End While
End If

End If
End Sub

Please suggest how can i populate my datagrid in second form by using the Data populated in Datagrid of Firrt Form


(No response found.)

Login to post response