Determining the Type for a datagrid column

G

Guest

I have a datagrid with several columns. When trying to validate the column
by looping through each column in the collection using a subscript I need to
first determine whether the column is defined as a string or an integer. Is
there a function that will allow me to do this? Note that the column types
and data remain the same. I just need to know whether the column is defined
as a string or integer to decide what validations to do.

Example:


Dim r As DataRow
Dim cols As DataColumnCollection
Dim c As DataColumn
cols = dstable1.Tables("Table1").Columns

For Each r In dstable1.Tables("Table1").Rows
For Each c In cols
If r(c, DataRowVersion.Current) ??? is string or integer
???
do something
next c
next r


thanks
 
M

Morten Wennevik

Hi mh1mark

Would you by any chance be looking for the DataColumn.DataType property?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top