Can some explain in laymans terms the difference between the to convertion keywords please.
I think I have it but just want to be sure. The help says
Dim Q As Object = 2.37
Dim I As Integer = CType(Q,Integer)
Dim J as Integer = DirectCast(Q,Integer)
I succeeds as 2.37 converts to an Integer...
J fails as Q was declared as an Object not an Integer so DirectCast fails.
Question is why use DirectCast instead of CType
Apologies incase this is a stupid question
I think I have it but just want to be sure. The help says
Dim Q As Object = 2.37
Dim I As Integer = CType(Q,Integer)
Dim J as Integer = DirectCast(Q,Integer)
I succeeds as 2.37 converts to an Integer...
J fails as Q was declared as an Object not an Integer so DirectCast fails.
Question is why use DirectCast instead of CType
Apologies incase this is a stupid question