|
-
Jun 30th, 2000, 12:45 PM
#1
Thread Starter
Fanatic Member
Hi all.
Wouldn't this code Dim strIn as a variant?
Code:
Dim strIn, strOut As String
Thanks.
-
Jun 30th, 2000, 12:49 PM
#2
Hyperactive Member
-
Jun 30th, 2000, 01:13 PM
#3
_______
///
NO
Simply because it is contained in the one dim statement
Dim strIn
that makes it a variant
Dim strIn,strOut as string
that makes it a string
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 30th, 2000, 01:26 PM
#4
transcendental analytic
Yes, it will
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 30th, 2000, 01:39 PM
#5
Thread Starter
Fanatic Member
Still Unsure
So,
I've received 2 yes's and 1 no! Will someone please give a definitive answer?
Thanks.
-
Jun 30th, 2000, 01:40 PM
#6
Frenzied Member
YES!!!
*** comment about posting incorrect replies removed by seaweed because it just seemed too harsh! ***
If you dim variables with one dim statement, you still must explicitly define the type of each variable in the list. Those that are not explicitly defined will be Variants.
Here's an easy way to test it. Dim two variables, but only declare the type of the last one. Then try to set each variable to data of another type.
Guess which variable causes the type mismatch error when you run this:
Code:
Option Explicit
Private Sub Form_Load()
Dim var1, var2 As Integer
var1 = "Hello"
var2 = "Hello"
Unload Me
End Sub
Of course it's the second variable, because the first one was automatically typed as a Variant by VB.
[Edited by seaweed on 07-01-2000 at 03:36 AM]
-
Jun 30th, 2000, 01:57 PM
#7
_______
SORRY
seaweed:
I actually thought I was right!!!!
If I though I was wrong I wouldn't have posted it.
I was wrong..I was mistaken... I accept that...I am sorry!
Life goes on!
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 30th, 2000, 02:12 PM
#8
Frenzied Member
No big deal
-
Jun 30th, 2000, 02:12 PM
#9
transcendental analytic
HeSaidJoe, don't worry, we all do that sometimes 
I've seen your posts lately very helpful to people, good work! You might get guru one day
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 30th, 2000, 02:21 PM
#10
_______
thanks.
thank you...guru isn't the reason I play here..
I learn more by trying to help others that I did
in 8 night semesters of VB4,5,6
Actually, it was one of the teachers as night school
who said that if you wanted to declare 6 variables
as string just do Dim 1,2,3,4,5,6 as string..
obviously....she was wrong.
All the best,
Wayne
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jun 30th, 2000, 02:26 PM
#11
Lively Member
Until today I thought that putting multiple variables on one dim line meant that they were all the same also. I tested it and found out that it was not so.
One of my professors was wrong also it seems
VB 6 Professional Edition
-
Jun 30th, 2000, 10:34 PM
#12
Thread Starter
Fanatic Member
Thanks.
To everyone for your input.
It seems that VB teachers can't be trusted! Except the "teachers" who frequent this Forum of course.
All the best.
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
|