Solved

gridview record show selected... vb.net

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

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Many of us here at EE write code. Many of us write exceptional code; just as many of us write exception-prone code. As we all should know, exceptions are a mechanism for handling errors which are typically out of our control. From database errors, t…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

708 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

15 Experts available now in Live!

Get 1:1 Help Now