How to access individual table column data?

  • Thread starter Thread starter Dot net work
  • Start date Start date
D

Dot net work

Say I have a table object that contains several columns, and the first
column is the column I'm intested in, and it contains numeric values.

I'd like to call a function and pass in those column values, like
this:

(Calling code) MyFunction(table.columndata(0))

(function definition) MyFunction(col as arrayofint?)

This is pseudo code to illustrate my point -- but does anyone know if
this can be done, and what the syntax would look like please?

TIA,
-dnw.
 
DNW,

You mean something as this, roughly written in this message so watch typos
\\\
Dim myarray(talble.rows.count) as integer
Dim col As DataColumn = table.Columns(0)
For i as integer = 0 to table.rows.count-1
myarray(i) = Cint(table.rows(i)(col))
Next
///

I hope this helps?

Cor
 
Hi Cor,

I was wondering if there was a nifty .Net framework shortcut way of
doing what you have written.

-dnw.
 
Why don't you pass just DataTable instance and DataColumn instance and do a
loop through all rows within your function?
 
Back
Top