Wrox Home  
Search P2P Archive for: Go

  Return to Index  

pro_vb thread: Some variables = Empty, some = 0


Message #1 by "Jerry Diegel" <diegelj@g...> on Fri, 23 Aug 2002 14:45:33 -0500
You actually declaring the first variable as variant - not single=2E
I believe, single like other number types are never "empty" but 0 upon
declaration=2E

-----Original Message-----
From: Jerry Diegel [mailto:diegelj@g...=2Ecom]
Sent: 23 August 2002 20:46
To: professional vb
Subject: [pro_vb] Some variables =3D Empty, some =3D 0


Can someone explain this two me=2E  I have a Class Module that does the
following=2E

Dim sngMin_Cap, sngMax_Cap As Single

Private Sub Class_Initialize()
    sngMin_Cap =3D Empty
    sngMax_Cap =3D Empty
End Sub


Now, by my thinking, these two variables should already be Empty=2E  However,
what I'm seeing is that sngMin_Cap will be empty while sngMax_Cap =3D 0=2E  What
I discoverd is that the last variable in my Dim statement is always equal to
zero=2E  This bites, since my program tests for Empty at one point, and if the
value is zero, it messes up=2E  What I found even stupider was that if I added
sngDummy at the end of my Dim statement both sngMin_Cap and sngMax_Cap will
then both be Empty=2E  To top it all off, assigning Empty to the variable
doesn't even seem to affect the things equal to zero=2E

I also found that if I give both variables their own personal Dim statement,
both will equal zero=2E

What's up with this?


Thanks,

Jerry


---
Visual C# - A Guide for VB6 Developers
This book will make it easy to transfer your skills=20
from Visual Basic 6 to C#, the language of choice=20
of the =2ENET Framework=2E
http://www=2Ewrox=2Ecom/ACON11=2Easp?ISBN=3D1861007175&p2p0059

---
Change your mail options at http://p2p=2Ewrox=2Ecom/manager=2Easp or=20
to unsubscribe send a blank email to leave-pro_vb-282671W@p...=2Ewrox=2Ecom=2E


  Return to Index