Solved

gridview record show selected... vb.net

Posted on 2014-10-01
2
274 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 33

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

773 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