Solved

gridview record show selected... vb.net

Posted on 2014-10-01
2
277 Views
Last Modified: 2014-10-05
The following line highlights the correct record:

Me.TblCustomersDataGridView.Rows(intCustIDReturn).Selected = True

But, row 1 (RowIndex=0)  of the first column also shows highlighted with selected triangle also in this row's RowHeader area.

Question: How can I revise the above line to show only Rows(intCustIDReturn) highlighted along with selected triangle at this row?

Thank you.
0
Comment
Question by:Mike Eghtebas
2 Comments
 
LVL 20

Accepted Solution

by:
Daniel Van Der Werken earned 500 total points
ID: 40355590
Try this:

Loop through all the Rows(loopIndexValue) and set .Selected = False.

Then, set the selected row: Rows(intCustIDReturn).Selected = True.

So, the key is to make sure they are *all* de-selected first, then select the one you want. My guess is you're selecting two without knowing it. Try this, check the value of the .Selected property in the debugger when this issue occurs.
0
 
LVL 34

Author Comment

by:Mike Eghtebas
ID: 40355614
Hi Dan,

Thanks for the comment. I used:
If bolHighlightActiveRow Then Me.TblCustomersDataGridView.Rows(intCustIDReturn).Selected = True
        Me.TblCustomersDataGridView.Rows(0).Selected = False
        bolHighlightActiveRow = False

Open in new window

Mainly because it is always the first row I need to deselect. This removes the highlight from first row. But, the select-triangle still stays at first row. It should be moved to Rows(intCustIDReturn).

BTW, coluld you please show me how to loop through to deselect all rows? That might be the reason why I am still having this problem.

Thanks,

Mike
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question