Column Count

bfafiani

Member
Joined
Mar 30, 2006
Messages
8
Programming Experience
1-3
HI,
I am trying to do something like the following, is it possible?

For index = 0 as integer To (The No. of columns in the table/dataset)
If ( HeaderofColumn(index) ) = (SOME STRING) then
*****
End If
Next index

I hope I have explained this clearly, I appreciate any help.
Thank you.
Bren.
 
Column count in a datatable i assume?

VB.NET:
Expand Collapse Copy
For I as Integer = 0 to Datatable.Columns.Count-1
If Datatable.columns(i).ColumnName.Equals(Whatever) then
 
 
Do Whatever Here
 
end if 
next
 
Thank you so much. Just one more question. Do I have to fill the table. Currently My column count for the table is 0.

Dim dtbUser As DataTable
dtbUser = New DataTable("tStudents")

MsgBox(dtbUser.Columns.Count)

For I As Integer = 0 To dtbUser.Columns.Count - 1
If dtbUser.Columns(I).ColumnName.Equals(CurrentClass) Then

MsgBox("here")
End If
Next I

I would greatly appreciate any help as I have a presentation in 45 minutes and this is the final piece of code.
 
Well yes you have to fill datatable with data from whatever datasource you are using i.e access database, text file etc....

You would use a dataadapter to fill your datatable with information.
 
Back
Top