Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

verify if data field type

Status
Not open for further replies.

ionutdinulescu

Programmer
Jun 11, 2002
59
0
0
GB
I have a DataRow dr variable.
I would like to check if dr(i) is of type DateTime.
How can I do this ?
 
I have tried the following
If (dr(0).GetType.ToString = "System.DateTime") Then
lv.SubItems.Add(dr(0).Date)
end if

The first line of code seems to work fine (it recognizes the date fields(, but the second one gives Null reference exception.
Do you have any idea ?
 
what is this line suppossed to do

dr(0).Date

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Code:
cdate (dr(0))

perhaps?

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top