?
Solved

Dim a variable as a unkown type

Posted on 2006-03-22
2
Medium Priority
?
270 Views
Last Modified: 2010-04-23
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



0
Comment
Question by:Gunit2507
2 Comments
 
LVL 6

Expert Comment

by:hatem72
ID: 16260857

are u mean Declar variable As variable ???

0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 2000 total points
ID: 16261149
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

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses
Course of the Month15 days, 18 hours left to enroll

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question