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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HowDoI Test and object for type... 2

Status
Not open for further replies.

sqlsamurai

Programmer
May 11, 2005
120
US
I want to test an object for type and I'm not sure how.

Here is the object:
My.Settings("StartDate")

I want to test the value to see what type it is.

Like this

If My.Settings("StartDate").GetType = DateTime then
...
End IF

Could somebody help?
 
Hi.

When you add a setting, you specify its type.... so you know what it is. Anyway ..

If My.Settings("StartDate").GetType.ToString() = DateTime then


Regards
 
or use TypeOf

Code:
TypeOf My.Settings("StartDate") is DateTime
 
Thanks for all the suggestions guys. ;-) In the end this is what I used.

If My.Settings("StartDate").GetType.Equals(GetType(Date)) Then
End If
 
Hi, just to undo my mistake..

If My.Settings("StartDate").GetType.ToString().ToLower() = "system. bla bla" then
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top