Private Sub ReadAllDataFromGridView()
' Assuming GridView1 is your GridView control
If GridView1.DataSource IsNot Nothing AndAlso TypeOf GridView1.DataSource Is DataTable Then
Dim dataTable As DataTable = DirectCast(GridView1.DataSource, DataTable)
' Iterate through all rows in the DataTable
For Each row As DataRow In dataTable.Rows
' Access data in each column (replace "ColumnName" with the actual column name)
Dim columnValue As Object = row("ColumnName")
' Do something with the column value (for example, print it)
Console.WriteLine("Column Value: " & columnValue)
' Handle the case where the GridView's data source is not a DataTable
Console.WriteLine("GridView data source is not a DataTable.")