G
Guest
Hi
I've got a problem, I have a structure named mStruc but when I create a variable of that type I need to initialize all of its members otherwise I get an exception System.NullReferenceException when I make reference to the variable (that's obvious)
Is there a way to set default values for the members of a structure so that I don't get an error before initializing it? All I could get in the help is that you can't do that directly in the structure but you can use this inside the structure..
Public Structure mStru
Dim mVal as intege
Sub New(ByVal Tval as integer
mVal = Tva
End Su
End Structur
How does it work? I mean, this sub new inside the structure....I tried this but I got the same, I’m a VB6 programmer so I’m very newbie in all about VB.NET, I think I'm missing something...or should I use a class instead??? As you can see, any comment will be very helpful :-
Thank
FO
I've got a problem, I have a structure named mStruc but when I create a variable of that type I need to initialize all of its members otherwise I get an exception System.NullReferenceException when I make reference to the variable (that's obvious)
Is there a way to set default values for the members of a structure so that I don't get an error before initializing it? All I could get in the help is that you can't do that directly in the structure but you can use this inside the structure..
Public Structure mStru
Dim mVal as intege
Sub New(ByVal Tval as integer
mVal = Tva
End Su
End Structur
How does it work? I mean, this sub new inside the structure....I tried this but I got the same, I’m a VB6 programmer so I’m very newbie in all about VB.NET, I think I'm missing something...or should I use a class instead??? As you can see, any comment will be very helpful :-
Thank
FO