Double Click on Datagrid

florycane

New member
Joined
Jan 22, 2008
Messages
1
Programming Experience
Beginner
Hi All

I am trying to populate a new form with the datagrid row information whenever a user double clicks on the datagrid row, so far I am not having any luck... below is the code
I am using VB 2008 .NET framework 3.5


Imports System.Data.Odbc

Public Class StockSelectEdit
Public drFindCode As New DataSet

Private Sub btnFindCode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindCode.Click

Dim connString As String = StockEdit.Projconn
Dim actualConn As New OdbcConnection(connString)
Dim codeEntered As String
codeEntered = txtEntercode.Text
actualConn.Open()
Dim sqlFindCode As String = "select STSZ_VSC, STSZ_VTYV_VALUE_SCTYPE, STSZ_SDESC from STOCK_CATALOG WHERE STSZ_VSC LIKE '" & codeEntered & "%'"

Dim cmdFindCode As New OdbcDataAdapter(sqlFindCode, actualConn)

cmdFindCode.Fill(drFindCode, "STOCK_CATALOG")
DataGridView1.DataSource = drFindCode.DefaultViewManager
DataGridView1.DataSource = drFindCode.Tables(0)

actualConn.Close()
cmdFindCode = Nothing
End Sub

Now whenever a user doubleclicks on any record on the datagrid, I want a new form with the record details in text boxes, so that I can make changes and click the update button to save.... I tried a lot of stuff, but nothing seems to work...

Private Sub DataGridView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.DoubleClick

End Sub
End Class


Any help will be highly appreciated...
 
Back
Top