Retrive value from datagrid

We can retrive datagrid value by using the following code:


in dot net
it will work


Author: Alfred Dominguez08 May 2015 Member Level: Bronze   Points : 3

I tried this and it WORKED as expected...great tip. But have one question. how do you handle if the cell has a NULL value? thanks in advance for your suggestion.
here is sample code i'm using
Dim dgstring As String

If DataGridView3.Tag = 0 Then
For i = 0 To DataGridView3.Columns.Count - 1
dgstring = dgstring & DataGridView3(columnIndex:=i, rowIndex:=1).Value.ToString()

End If

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: