Dim a variable as a unkown type

I have a variable holding a type code that was set earlier

Dim MyType1 As TypeCode = String
Dim MyType2 As TypeCode = Boolean

Then I want to declare a variable using that type code

Dim MyVariable As MyType1 = ""
Dim MyVariable As MyType2 = 1/2/2006



Gunit2507Asked:
Who is Participating?
 
Jens FiedererTest Developer/ValidatorCommented:
Declarations are static, so you can't do what you want.

But if you declare MyVariable as Object
MyVariable will be able to hold any kind of data ... and you can still use gettype to figure out the real type.
0
 
hatem72Commented:

are u mean Declar variable As variable ???

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.