Hi Guys
I hope someone can help I have a form that loads a gridview at runtime based on users logon names which is pretty easy the data I load lives in an excel document, I want to be able to read the data from the datagrid view I loaded at runtime, like a sort of ini file
my question what is the syntax to read data from a a datagridview in vb.net, the datagrid is pretty simple it has only one columm and at most it has 6 rows of different information that I need to read from it.

Recommended Answers

All 3 Replies

Dim row1 As String = datagridview1.Rows(0).Cells(0).Value
Dim row2 As String = datagridview1.Rows(1).Cells(0).Value
Dim row3 As String = datagridview1.Rows(2).Cells(0).Value
Dim row4 As String = datagridview1.Rows(3).Cells(0).Value
Dim row5 As String = datagridview1.Rows(4).Cells(0).Value
Dim row6 As String = datagridview1.Rows(5).Cells(0).Value
Dim row1 As String = datagridview1.Rows(0).Cells(0).Value
Dim row2 As String = datagridview1.Rows(1).Cells(0).Value
Dim row3 As String = datagridview1.Rows(2).Cells(0).Value
Dim row4 As String = datagridview1.Rows(3).Cells(0).Value
Dim row5 As String = datagridview1.Rows(4).Cells(0).Value
Dim row6 As String = datagridview1.Rows(5).Cells(0).Value

Thanks for this I used a loop to increment each row.

That's what you usually do. :)

Please mark this thread as solved if this was helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.