|
-
Jul 27th, 2006, 09:14 AM
#1
Thread Starter
Frenzied Member
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
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
-
Jul 27th, 2006, 09:18 AM
#2
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 ), then do
VB Code:
Dim intVar As Integer, intVar1 As Integer, intVar2 As Integer
Etcetera
-
Jul 27th, 2006, 09:28 AM
#3
Re: declaration of variable problem
 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.
-
Jul 27th, 2006, 10:27 AM
#4
PowerPoster
Re: declaration of variable problem
Your memory serves you well schoolbusdriver
-
Jul 27th, 2006, 10:33 AM
#5
Re: declaration of variable problem
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|