VB.NET Datagridview Selected Cell / Row - TechRepublic
Question
October 11, 2010 at 04:05 AM
martinbullock15

VB.NET Datagridview Selected Cell / Row

by martinbullock15 . Updated 15 years, 8 months ago

Hi

I have a DataGridView which is populated from a query. It only has two columns, I want to be able to select a cell, then when a button is click it gets the value in Column 1 assigns it to one textbox and then gets the value of Column 2 and assigns that a different textbox of the Row where the Cell is Selected.

——Col1–|–Col2–
Row1—A—-|—1—-
Row2—B—-|—2—-
Row3—C—-|—3—-

So if Col1/Row2 was selected it highlights the whole row but returns textbox1 “B” textbox2 “2”

I have set the DataGrid Property to “FullRowSelect” and MultiSelect “False” so whereever the user clicks it selects the row and therefore all the relevant data is highlighted and also avoids the problem of multi selections.

Any suggestions would be very grateful

Kind Regards

This discussion is locked

All Comments