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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to select, usig code, an entire row in a DataGrid

Status
Not open for further replies.

Toranaga

Programmer
Nov 14, 2002
11
RO
I want to select an entire row in a DataGrid using code, not the mous, but I've got no idea how I could do that. I've set the property

"DataGrid1.MarqueeStyle = dbgHighlightRow".

If the grid had a method, like this

"DataGrid1.SelectRow(x)"

it would be just fine, but it hasn't. I tried all the methods of the DataGrid control, but I didn't find any working solution to select an entire row. All I foud was how to select a range of columns:
"DG1.SelStartCol = 0
DG1.SelEndCol = 5"

Someone advised me to simulate a maus click (using API) on the row I want to select, but I think this is not a solution.
I hope someone could help me to solve this problem.

Thanx a lot.
 
You should be able to use rthe data grids .row property to set the active or current row at runtime.

datagrid1.row=??

But I don't know if you will be able to get the same visual effect as with a mouse click. In other words the row will probably not be highlighted. Thanks and Good Luck!

zemp
 
Thanx a lot, man ! It's working! I can't believe it was so simple, because I was trying only complicated solutions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top