Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - selected row visible

Reply
 
Old 08-27-2008   #1 (permalink)
EricW


 
 

selected row visible

Hi

The following code is in the load event of a form.
When the user rightclicks on a row in a datagridview, the selected
information is passed on to this form.

Dim tbl As New Data.DataTable

tbl = Me.grd.DataSource

Dim strSelect As String
Dim ab As Integer

strSelect = ""
For ab = 0 To tbl.Columns.Count - 1
strSelect += tbl.Columns(ab).ColumnName + " LIKE '" + myRowData(ab)
+ "'"
If ab < tbl.Columns.Count - 1 Then strSelect += " AND "
Next

Dim foundRows() As Data.DataRow
foundRows = tbl.Select(strSelect)

SelRow = foundRows(0).Table.Rows.IndexOf(foundRows(0))

Me.grd.Rows(SelRow).Selected = True

' now move the current cell to the top
Me.grd.CurrentCell = Me.grd.Rows(SelRow).Cells(0)
Me.grd.FirstDisplayedScrollingRowIndex = SelRow


In the datagridview of the second form, I want the selected row to show up
at the top of the datagridview.
But it is not happening.

Nothing seems to happen with the last line, which should do the job.

Who can help me with this?

rg,
Eric







My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Get value of first cell in selected row in DataGridView? .NET General
scanner selected cannot be found Vista print fax & scan
Selected message in newsgroup Vista mail
How to backup only selected files? Vista file management
Backup Selected Files Only? Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46