never mind found it
The difference between the two keywords is that CType succeeds as long as
there is a valid conversion defined between the expression and the type,
whereas DirectCast requires the run-time type of an object variable to be
the same as the specified type. If the specified type and the run-time type
of the expression are the same, however, the run-time performance of
DirectCast is better than that of CType.
"Brian Henry" <brianiup[remove-me]@adelphia.net> wrote in message
news:uE**************@TK2MSFTNGP10.phx.gbl...
thanks! i knew it in my head but i just couldn't remember the names of
them... is there any real diffrence between the two?
"Rob Teixeira [MVP]" <RobTeixeira@@msn.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl... Use CType or DirectCast
-Rob Teixeira [MVP]
"Brian Henry" <brianiup[remove-me]@adelphia.net> wrote in message
news:ee**************@TK2MSFTNGP12.phx.gbl... If i have a structure type and i place the structures data into a tag
property (which is an object) it will go in obviously, but when i pull an object back into a structrured type it will error.. how do i convert
the object back into a struct? here's an example
public structure teststruc
public name as string
public id as integer
end structure
dim a as teststruc
with a
.name = "me"
.id = 10
endwith
me.tag = a ' this part obviously works fine
' but when i do this i have a conversion error
dim b as teststruc
b = me.tag ' error here converting from object to teststruc
me.textbox1.text = b.name
how would i convert the structure back from an object? thanks