Solved

VB 2008  - How to Select rows in a DataGridView

Posted on 2009-07-09
6
249 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
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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

770 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