DataGridView Question

J

Joe

I admit that although I am an experienced programmer, I am a
complete novice when it comes to using the DataGridView component
(VS2005) with VB.NET

I am trying to access the value in a specific cell of the
selected row. DatagridView contains a list of timesheets. It is
bound to a dataset containing a datatable - dtTimesheets. In this
table and also the grid, TimesheetID is in the left most column
followed by some other information in about the timesheets in the
other columns. I want to do something like this:

Dim SelectedTimesheetID As Integer

SelectedTimesheetID = dbgrdTimesheets. ????

I don't want the INDEX, I want the actual value of the data in
that cell.

Can someone assist me with the right side of this statement?


Any help truly appreciated,
J
 
S

Spanky deMonkey

Private Sub dgClients_CellEnter(ByVal sender As Object, _
ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) _
Handles dgClients.CellEnter

MessageBox.Show(dgClients.Rows(e.RowIndex).Cells("fldClientID").Value)

End Sub


Is that what you might be looking for? You could use the CellLeave event if
you wish.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top