I have a Win Forms application application in VB.NETVisual Studio 2008.
There is a form with a Datagrid view of data on it and a button.
The idea is that:
1) The dialog pops up when a selection is made on the main form.
2) the dialog has a data grid view on it which displays rows of relevant records
3) The user selects the row they are interested in
4) The user selects the OK button on the dialog
5) the dialog closes and retuens focus to the main form .
What I want to know is how do I get the dialog to pass back the key value of the selected row when the dialog closes.
I have included the simple code to date for open and close.
Thanks for your help
the user selects the row in the data grid that they are interested in. Then they click the dialog fom's OK button. At this point the dialog closes - but I want the dialog to pass back the key value from the selected row in the data grid view to the calling procedure.
When the dialog is closed I want the value selected in the dialog
'The Dialog form is opened from the main form
Private Sub mnubtnList_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mnubtnList.Click
'Open the search list - showing all of the available contact records
Dim frm As New frmSearchContacts()
'Some code goes here to collect the value o the closed dialog box !!!
'The dioalog is closed once a user has selected a value
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK