Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 [RESOLVED] Get value from DataGridView on form load

$
0
0
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)


Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>