INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Jobs from Indeed

HowDoI Test and object for type...

HowDoI Test and object for type...

(OP)
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?

RE: HowDoI Test and object for type...

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

RE: HowDoI Test and object for type...

or

My.Settings("StartDate").GetType is DateTime

Christiaan Baes
Belgium

"My new site" - Me

RE: HowDoI Test and object for type...

or use TypeOf

CODE

TypeOf My.Settings("StartDate") is DateTime

RE: HowDoI Test and object for type...

(OP)
Thanks for all the suggestions guys. winky smile In the end this is what I used.

If My.Settings("StartDate").GetType.Equals(GetType(Date)) Then
End If

RE: HowDoI Test and object for type...

Hi, just to undo my mistake..

If My.Settings("StartDate").GetType.ToString().ToLower() = "system. bla bla" then

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close