Click here to Skip to main content
15,914,016 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Subs and Functions w/ Optional Args Pin
Richard Deeming11-Nov-02 23:55
mveRichard Deeming11-Nov-02 23:55 
GeneralMonochrome Bitmap Pin
Jamie Nordmeyer11-Nov-02 6:41
Jamie Nordmeyer11-Nov-02 6:41 
Generalnework folder connection problem using vb.net Pin
pampatipraveen10-Nov-02 14:12
pampatipraveen10-Nov-02 14:12 
GeneralRe: nework folder connection problem using vb.net Pin
Ravi_Shankar11-Nov-02 2:35
Ravi_Shankar11-Nov-02 2:35 
GeneralSocket/TCPclient (Seriazlation) Pin
DeSerializeMe10-Nov-02 12:52
sussDeSerializeMe10-Nov-02 12:52 
GeneralPrinting on dot-matrix printer in .NET Pin
Derec Roofie10-Nov-02 10:53
Derec Roofie10-Nov-02 10:53 
GeneralAxInterop.AXRfaxVwRctrLLib Pin
Zulfikar Ali8-Nov-02 12:57
Zulfikar Ali8-Nov-02 12:57 
QuestionObject behaviour of simple data types? Pin
Jan Tielens8-Nov-02 0:37
Jan Tielens8-Nov-02 0:37 
Hi all,

In .NET all data types (Integer, Long, String, ...) are objects. But in my opinion, these data types don't really behave like normal objects. I noticed the following behaviour:

Dim l As Long<br />
<br />
Msgbox(l = Nothing)<br />
'Results in True<br />
<br />
Msgbox(l = 0)<br />
'Results in True


Even stranger behaviour:

Dim l As Long<br />
<br />
l = 0<br />
<br />
Msgbox(l = Nothing)<br />
'Results in True


I hoped that in .NET there would be a way to determine if a variable has been set or not. For example you have a class with a ID property (long), you would implement it like this:
Public Class Test<br />
    Private _id As Long<br />
    Public Property ID As Long<br />
        Get<br />
            Return _id<br />
        End Get<br />
        Set(Value As Long)<br />
            _id = Value<br />
        End Set<br />
    End Property<br />
End Class

Suppose you would like to have functionality in this class, to save the data. In de Save sub, you would like to check if the ID property was set or not. I hoped you could do it like this:
Public Sub Save<br />
    If _id = Nothing Then<br />
        'Raise error to tell the ID property was not set.<br />
    Else<br />
        'Save data<br />
    End If<br />
End Save


Was it wrong of me to expect such behaviour, or am I wrong somewhere?


Thanks,
Jan
AnswerRe: Object behaviour of simple data types? Pin
Richard Deeming8-Nov-02 7:07
mveRichard Deeming8-Nov-02 7:07 
GeneralTreeView redraw lag.. Pin
dazinith7-Nov-02 10:41
dazinith7-Nov-02 10:41 
GeneralRe: TreeView redraw lag.. Pin
mikasa7-Nov-02 11:10
mikasa7-Nov-02 11:10 
GeneralRe: TreeView redraw lag.. Pin
mikasa7-Nov-02 11:14
mikasa7-Nov-02 11:14 
GeneralRe: TreeView redraw lag.. Pin
dazinith11-Nov-02 4:32
dazinith11-Nov-02 4:32 
GeneralRe: TreeView redraw lag.. Pin
mikasa26-Mar-03 3:31
mikasa26-Mar-03 3:31 
GeneralVB Silent Install Pin
Davy Mitchell6-Nov-02 4:43
Davy Mitchell6-Nov-02 4:43 
GeneralRe: VB Silent Install Pin
Nick Parker6-Nov-02 16:49
protectorNick Parker6-Nov-02 16:49 
GeneralRe: VB Silent Install Pin
Davy Mitchell6-Nov-02 22:09
Davy Mitchell6-Nov-02 22:09 
GeneralLaunching External Exe File Pin
Desmond5-Nov-02 22:43
Desmond5-Nov-02 22:43 
GeneralRe: Launching External Exe File Pin
Nick Parker6-Nov-02 2:12
protectorNick Parker6-Nov-02 2:12 
GeneralRe: Launching External Exe File Pin
Vasudevan Deepak Kumar6-Nov-02 4:02
Vasudevan Deepak Kumar6-Nov-02 4:02 
QuestionMultiple DataTables in DataGrid? Pin
ILoveInternet5-Nov-02 22:10
ILoveInternet5-Nov-02 22:10 
AnswerRe: Multiple DataTables in DataGrid? Pin
Tuukka Turto19-Nov-02 19:42
Tuukka Turto19-Nov-02 19:42 
GeneralDrawing Issue Pin
Jamie Nordmeyer5-Nov-02 9:46
Jamie Nordmeyer5-Nov-02 9:46 
GeneralRe: Drawing Issue Pin
Nick Parker5-Nov-02 12:56
protectorNick Parker5-Nov-02 12:56 
GeneralRe: Drawing Issue Pin
Jamie Nordmeyer6-Nov-02 4:15
Jamie Nordmeyer6-Nov-02 4:15 

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.