Undetermined type conversion in VB.NET 2008
- by user337501
I figured this would be a quick google, but extensive searching hasnt yielded any results. Everything about type conversion seems to dance around this concept.
I want to get the type of variable "a", and make a new variable named "b" of that type. Otherwise I could have "a" as a type already declared and "b" simply as an Object, then try to cast "b" to the type of "a".
Dim a As Integer
Dim b As Whatever a Is
OR
TryCast(b, Whatever a Is)
I would also like to make the conversion using a variable representation of the type, but cant find info on how to do that either.
Sorta like:
Dim a As Integer
Dim b As Object
Dim t As Type
t = a.GetType()
TryCast(b, t)
Realizing I'm completely misusing TryCast here, I'm mostly trying to get my goal across. I figured it would be an easy quick thing to do but I cant really find any specific info on it. Any ideas?