Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datagrid Hittest Question

Status
Not open for further replies.

PaulinKC

Programmer
Apr 2, 2002
50
US
Ok I'm stumped now... I'm working on a vb.net app using the datagrid control that is bound to a dataset. I'm able to populate the datagrid with no problems... what I want to do now is have the user select a row in the datagrid that issues a sql select statement based on the row that is selected to populate another form.

the code that I am using to get the row # is as follows:

Code:
    Private Sub DataGrid1_MouseUp(ByVal sender As System.Object, ByVal e As MouseEventArgs) Handles DataGrid1.MouseUp

        Dim pt = New Point(e.X, e.Y)
        Dim hti As DataGrid.HitTestInfo = Me.DataGrid1.HitTest(pt)

        If hti.Type = DataGrid.HitTestType.Cell Then
            MessageBox.Show(DataGrid1(hti.Row, hti.Column).ToString())
        Else

            If hti.Type = DataGrid.HitTestType.RowHeader Then
                
                MessageBox.Show(hti.Row)

            End If
        End If

    End Sub

how would I format the sql select statement to get me the row # that I am wanting? the database that I am using is MS Access, not MSSQL. Any insight or help would be greatly appreciated!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top