hi everybody,
I'm looking everywhere to find out a way to access a specific column and row of a datagrid generated by a sql-query in visual basic.

The datagrid looks, simplified, like this:

column1 column2
data1 data2

now I would need a function, that reads data2 out in visual basic (asp.net web)

any help would be very appreciated ;-)

thanks in advance
Georges-Louis

Member Avatar for saravind84

HI,

Assign the data source of the data grid to a DataTable, and access the Data from the data table. Please find the code snippet below.

Dim dtTable As DataTable = dgGrid.DataSource()
 Dim strVal As String = dtTable.Rows(0)(0).ToString()

You can get the value of the first row, first column in the variable strVal.

hi saravind84,
it work, thanks a lot for your help :)
Cheers
Georges-Louis

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.