|
-
Nov 27th, 2004, 08:45 PM
#1
Thread Starter
Lively Member
row select using datagrid
Hi everyone,
I'm using a datagrid to display the name of customers and some details. Everytime I click on any of the fields it only selects that cell I've clicked on, instead of selecting the whole row just as it happens in any table in any windows program.
Does anyone know how to change that??
Thanks in advance
-
Nov 28th, 2004, 01:02 AM
#2
Hyperactive Member
kinda a dirty fix, but it works:
VB Code:
Private Sub grdResults_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdResults.MouseUp
'declare the vars
Dim pt As New Point(e.X, e.Y)
Dim hti As DataGrid.HitTestInfo = grdResults.HitTest(pt)
'if type is cell, select row
If (hti.Type = DataGrid.HitTestType.Cell) Then
grdResults.CurrentCell = New DataGridCell(hti.Row, hti.Column)
grdResults.Select(hti.Row)
End If
End Sub
-
Nov 28th, 2004, 05:23 AM
#3
Thread Starter
Lively Member
Alright thank you,
What I'm actually doing now is different but I came to it thanks to you!
Private Sub grdResults_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles grdResults.MouseUp
grdResults.Select(grdResults.CurrentRowIndex)
End Sub
Thanks a lot you fixed my problem!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|