Datagrid first record unenabled

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
I don't think I used the right word "unenabled". When the user opens a datagrid the "cursor" or pointer goes to the first record. There's a mark in the side of the datagrid alongside the first record. There's a listbox alongside to list your selections from the datagrid. If you click on the first column of the first record, nothing happens. If the datagrid has more than one column of data, then if you click on any of the columns but the first, your selection will appear in the list box. But nothng happens if you click on the first column of that first record. How can I program it so that the user can click anywhere on that first record so it becomes the selected item?

Thank you for your time

John
 
I think can achieve in the datagrid's mouse up event and put the following code

VB.NET:
[SIZE=2][/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] pt = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] Point(e.X, e.Y)
[/SIZE][SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] hti [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataGrid.HitTestInfo = dgList.HitTest(pt)
[/SIZE][SIZE=2][COLOR=#0000ff]If[/COLOR][/SIZE][SIZE=2] hti.Type = DataGrid.HitTestType.Cell [/SIZE][SIZE=2][COLOR=#0000ff]Then
[/COLOR][/SIZE][SIZE=2]  dgList.CurrentCell = [/SIZE][SIZE=2][COLOR=#0000ff]New[/COLOR][/SIZE][SIZE=2] DataGridCell(hti.Row, hti.Column)
  dgList.Select(hti.Row)
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2] [/SIZE][SIZE=2][COLOR=#0000ff]If
[/COLOR][/SIZE]
 
Click coordinates

Lingsn,

The code you gave me works great. I am trying to understand it. What you did was to capature the coordinates of any click within any cell in the gridbox, and if it a cell coordinate, select the row? is that the logic?

Thank you for your time

John
 
Back
Top