Solved

VB 2008  - How to Select rows in a DataGridView

Posted on 2009-07-09
6
241 Views
Last Modified: 2012-05-07
How do I select a row, or several rows (if multi-select) in a DataGridView?
0
Comment
Question by:ljcor
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
JackOfPH earned 500 total points
Comment Utility
What do you mean? Select? Highlight multiple rows?


Try this, The following code will select the first and third row in the datagridview

Datagridview1.Rows(0).Selected = True  
Datagridview1.Rows(2).Selected = True
0
 

Author Closing Comment

by:ljcor
Comment Utility
Yes, that is exactly what I wanted to do.   Thanks again.  Today I remember where you live!!  Italy?
Just kidding.  I do remember.
0
 
LVL 15

Expert Comment

by:JackOfPH
Comment Utility
:)
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

Author Comment

by:ljcor
Comment Utility
Perhaps you can add to this answer just so I know:  How can I select ALL rows in the grid?

For each row in MyDataGridView  (or something like that?)

Next

???
0
 
LVL 15

Expert Comment

by:JackOfPH
Comment Utility
Here: Sorry for the long response, I went home early yesterday... here is the code you want to do...


For each row as DatagridviewRow in MyDatagridview.rows
 

row.Selected = true
 

Next

Open in new window

0
 

Author Comment

by:ljcor
Comment Utility
I can always wait for a right answer.  Thanks Jack.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

762 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

8 Experts available now in Live!

Get 1:1 Help Now