?
Solved

VSTO - DataGridView get row index on click or selection

Posted on 2011-05-11
4
Medium Priority
?
476 Views
Last Modified: 2012-05-11
Hi

How do you get the column index of a DataGridView row that the user selects using VB.net code.
Thanks
can anyone also tell me where the VSTO zone is - it doesn't come up by entering that into the search box
0
Comment
Question by:Murray Brown
4 Comments
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 668 total points
ID: 35737761
You can use

dgv.SelectedRows(0).Cells(0).Value
0
 
LVL 17

Assisted Solution

by:nepaluz
nepaluz earned 668 total points
ID: 35738402
in the OnClick event, the row index is
e.RowIndex, so you can get it by
Dim MyIndex = e.RowIndex

Open in new window

0
 
LVL 36

Assisted Solution

by:Miguel Oz
Miguel Oz earned 664 total points
ID: 35742806
The above answers solve your main question.
Regarding VSTO, check:
http://www.experts-exchange.com/Microsoft/Development/VSTO/
it should come if you type VSTO on the zone box . But this is a Win form question.
0
 

Author Closing Comment

by:Murray Brown
ID: 35860336
Thanks all
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

After seeing numerous questions for Dynamic Data Validation I notice that most have used Visual Basic to solve the problem. This suggestion is purely formula based and can be used in multiple rows.
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
This Micro Tutorial demonstrates how to create Excel charts: column, area, line, bar, and scatter charts. Formatting tips are provided as well.
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

850 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