Selecting data from a data grid

G

Guest

I have a data grid, which I have successfully populated. I would like to add the functionality to this data grid, so that the users can scroll through the grid, select a record they would like to "check out" and then double click on the data grid, to populate another form (so they can "check out" the record).

I have the 2nd form, (populated from the user's choice on the data grid) built. I just need to caputure the 1st column of the record the user selects in the data grid and pass it to a stored procedure, and then the results of the stored procedure will populate the 2nd form.

If anyone has tried this, or has any ideas, please let me know.

Thank you in advance,

TJBernard
 
G

Guest

try something along the lines of...

Private Sub DGProgramme_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DGProgramme.DoubleClick
Try

Dim f As New ViewProgramme
f.prodID = DGProgramme.Item(DGProgramme.CurrentRowIndex, 0)
myvwprog.Show()

Catch ex As Exception
MessageBox.Show(ex.Message & vbCrLf & ex.StackTrace)
End Try

End Sub

this assumes that the ViewProgramme form contains the variable prodID, which is the UID of the record, and handles the code to extract and display the data, and that the UID of the records in the dataset are held in the first column (0) of the datagrid
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top