Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
how to access value of particular column of datatable in vb.net ? I want to add case in loop
Posted
Comments
[no name] 4-Aug-13 14:20pm    
Try yourTable.Rows.Item(0).Item("YouColumnName")
PrissySC 4-Aug-13 14:24pm    
datatable.rows(index).cells(index).value
or
datatable.rows(index).column(index).value

Is this what you are looking for? Iterate through the index to the column count and row count.
Maciej Los 4-Aug-13 14:30pm    
What have you tried? Where are you stuck?

Basically it would be..
VB
Dim o As Object = dataTable.Rows.Item(0).Item("ColumnNameOrIndex")

For more clearance see..
How to read values of a particular column from a datatable.[^]
http://p2p.wrox.com/pro-vb-6/12294-how-get-value-datatable-column.html[^]
 
Share this answer
 
'Assuming you have a datatable named dt1 with columns name Col1 (string datatype) and Col1. To read the value od Col1 at row 0

VB
Dim myStr As String  = dt1.Rows(0)("Col1").ToString()
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900