Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB 2008  - How to Select rows in a DataGridView

Posted on 2009-07-09
6
Medium Priority
?
255 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 15

Accepted Solution

by:
JackOfPH earned 2000 total points
ID: 24811891
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
ID: 31601493
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
ID: 24811915
:)
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ljcor
ID: 24811960
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
ID: 24819468
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
ID: 24820119
I can always wait for a right answer.  Thanks Jack.
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

722 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