declaration of variable problem
Hello
I am having a problem with the following code
VB Code:
Dim numAvailableSlotsDL,numslotsDLTx As Integer
the code throws up an error saying that
Quote:
Compiel error:
byref argument type mismatch
and the only way to correct it is by writing the definitions as
VB Code:
Dim numAvailableSlotsDL As Integer
Dim numslotsDLTx As Integer
what is the wrong with the first version of my code, i.e.
VB Code:
Dim numAvailableSlotsDL,numslotsDLTx As Integer
Re: declaration of variable problem
First off, the second way is always prefereble IMO. It is much clearer.
However, if you really really want to declare more than one variable on a single line (which drives me buggy :mad: ), then do
VB Code:
Dim intVar As Integer, intVar1 As Integer, intVar2 As Integer
Etcetera
Re: declaration of variable problem
Quote:
Originally Posted by vb_student
VB Code:
Dim numAvailableSlotsDL, numslotsDLTx As Integer
If I remember correctly, VB interprets the first variable as a variant because the type isn't specified.
Re: declaration of variable problem
Your memory serves you well schoolbusdriver :thumb:
Re: declaration of variable problem
Quote:
Originally Posted by schoolbusdriver
If I remember correctly, VB interprets the first variable as a variant because the type isn't specified.
Aside from the fact that I think declaring each variable individually, on a separate line, makes for far more clarity, this is another reason why I don't line mulitple variables declarations stretched out across one, single, line.