Click here to Skip to main content
15,915,319 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to Stop a Big Loop Pin
rrocha25-Dec-03 0:06
rrocha25-Dec-03 0:06 
AnswerRe: How to Stop a Big Loop Pin
Ian Darling5-Dec-03 0:19
Ian Darling5-Dec-03 0:19 
GeneralMy Computer Shell Extension Pin
MusclePup4-Dec-03 22:58
MusclePup4-Dec-03 22:58 
GeneralVisual Studio Freezing. Pin
cnurse4-Dec-03 21:40
cnurse4-Dec-03 21:40 
GeneralHelp me to draw Icon in CheckedListBox Pin
VitaminY4-Dec-03 16:38
sussVitaminY4-Dec-03 16:38 
GeneralCasting variables in VB.NET Pin
Jim Taylor4-Dec-03 12:16
Jim Taylor4-Dec-03 12:16 
GeneralRe: Casting variables in VB.NET Pin
Nick Seng4-Dec-03 14:48
Nick Seng4-Dec-03 14:48 
GeneralRe: Casting variables in VB.NET Pin
Dave Kreskowiak4-Dec-03 18:58
mveDave Kreskowiak4-Dec-03 18:58 
CType is more flexible because it's not limited to converting between standard types. It can be used to convert between composite types as well as converting an object to any one of its interfaces.

CType is also compiled in-line with the expression whereas the CInt is not. CInt calls a library function to convert an already evaluated expression result whereas CType code is actually compiled as part of the expression.

Now, DirectCast... The difference between the two 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

Consider the following code:
Dim Q As Object = 2.37   ' Requires Option Strict to be Off.
Dim I As Integer = CType(Q, Integer)   ' Succeeds.
Dim J As Integer = DirectCast(Q, Integer)   ' Fails.

The run-time type of Q is Double. CType succeeds because Double can be converted to Integer, but DirectCast fails because the run-time type of Q is not already Integer.
Clear as mud? Wink | ;)

RageInTheMachine9532
GeneralRe: Casting variables in VB.NET Pin
Jim Taylor4-Dec-03 22:48
Jim Taylor4-Dec-03 22:48 
Generalsending information from one application to another Pin
Leonard Munteanu4-Dec-03 10:39
Leonard Munteanu4-Dec-03 10:39 
GeneralRe: sending information from one application to another Pin
Dave Kreskowiak4-Dec-03 18:48
mveDave Kreskowiak4-Dec-03 18:48 
GeneralRe: sending information from one application to another Pin
Duncan Edwards Jones5-Dec-03 4:45
professionalDuncan Edwards Jones5-Dec-03 4:45 
GeneralRe: sending information from one application to another Pin
Guillermo Rivero5-Dec-03 11:06
Guillermo Rivero5-Dec-03 11:06 
GeneralRe: sending information from one application to another Pin
Dave Kreskowiak6-Dec-03 5:08
mveDave Kreskowiak6-Dec-03 5:08 
GeneralRe: sending information from one application to another Pin
dabuskol8-Dec-03 23:24
dabuskol8-Dec-03 23:24 
GeneralHide Folder and files Pin
R Sharma4-Dec-03 9:08
R Sharma4-Dec-03 9:08 
GeneralRe: Hide Folder and files Pin
Dave Kreskowiak4-Dec-03 18:51
mveDave Kreskowiak4-Dec-03 18:51 
Generaldate conversion Pin
gls2ro4-Dec-03 7:24
gls2ro4-Dec-03 7:24 
GeneralRe: date conversion Pin
Alex Korchemniy4-Dec-03 8:02
Alex Korchemniy4-Dec-03 8:02 
Generaldelimiters using VB.net Pin
ccandler4-Dec-03 4:29
ccandler4-Dec-03 4:29 
GeneralRe: delimiters using VB.net Pin
Colin Angus Mackay4-Dec-03 4:49
Colin Angus Mackay4-Dec-03 4:49 
GeneralRe: delimiters using VB.net Pin
Ian Darling4-Dec-03 4:57
Ian Darling4-Dec-03 4:57 
GeneralRe: delimiters using VB.net Pin
ccandler4-Dec-03 8:19
ccandler4-Dec-03 8:19 
GeneralRe: delimiters using VB.net Pin
Ian Darling4-Dec-03 12:35
Ian Darling4-Dec-03 12:35 
GeneralPing program on VB Pin
Nata_R4-Dec-03 1:41
Nata_R4-Dec-03 1:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.