Solved

gridview record show selected... vb.net

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

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

Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

919 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now