[RESOLVED] Get value from DataGridView on form load
I am trying to get a value fro a DataGridView 'DGV' when my winform loads ie, Forms2_load. DGV is bound and I am using the code below to Fill the DGV.
My question is, how do I get a value from 'DGV' without any user intervention, just when the form loads. I have FullRowSelect as default in properties and notice that when the form first loads the first entry in DGV is highlighted 'Blue'. Does this mean that the first row is selected by default? I tried a for next loop on the form load event, but no message pops up. Can someone please help with this. Thanks
Code:
Me.CustomersTableAdapter.Fill(Me.StorageDataSet1.Customers)
Dim values As String
For Each RW As DataGridViewRow In DGV.Rows
'Send the first cell value into messagebox'
values = RW.Cells(0).Value.ToString
Next
MessageBox.Show(values)
Re: [RESOLVED] Get value from DataGridView on form load
I see this is marked resolved although there have been no replies. Is it (resolved, that is)? In which case perhaps you'd like to add some details of what you learnt to aid others?