something to Not exist, basically you can pass 'Nothing' to a method whose
parameters as System.Nullable.
Im looking at table adapters ; you know those clever little things which
allow you to contrsuct methods for manipulating data use this. So a method
might be declared someting like this.
Private Sub myMethod(ByVal myYear As System.Nullable(Of Integer), ByVal
myw

End Sub
My question is. How to I translate this into a practical method call for a
value which may or may not exits. Lets say we have two text boxes.
yearTextBox and w

How to I assign an integer value or nothing depending on if the box is
emtpy, because you cant assign nothing to an integer. I dont want multiple
call lines to the one method, just one.
Goofy
GoofyGot it
Dim year As System.Nullable(Of Single)
Dim w

"Goofy" <me@.mine.com> wrote in message
news:%23X%23OA%23DJHHA.320@.TK2MSFTNGP06.phx.gbl...
> The 2.0 Framework has a new type called System.Nullable. This allows
> something to Not exist, basically you can pass 'Nothing' to a method whose
> parameters as System.Nullable.
> Im looking at table adapters ; you know those clever little things which
> allow you to contrsuct methods for manipulating data use this. So a method
> might be declared someting like this.
> Private Sub myMethod(ByVal myYear As System.Nullable(Of Integer), ByVal
> myw

> End Sub
> My question is. How to I translate this into a practical method call for a
> value which may or may not exits. Lets say we have two text boxes.
> yearTextBox and w

> How to I assign an integer value or nothing depending on if the box is
> emtpy, because you cant assign nothing to an integer. I dont want multiple
> call lines to the one method, just one.
> --
> Goofy
>
> --
> Goofy
>
"Goofy" <me@.mine.com> wrote in message
news:uMXc8jEJHHA.3872@.TK2MSFTNGP06.phx.gbl...
> Got it
> Dim year As System.Nullable(Of Single)
> Dim w

Not sure about VB.NET, but in C# v2 you can do this simply by appending a
question mark to the datatype e.g.
Int32 intYear = 0; // not nullable
Int32? intYear = null; // nullable
Didnt know that, but then I dont code in C# normally. This nullable facility
is really usefull in some situations I find.
"Mark Rae" <mark@.markNOSPAMrae.com> wrote in message
news:utmozHFJHHA.536@.TK2MSFTNGP02.phx.gbl...
> "Goofy" <me@.mine.com> wrote in message
> news:uMXc8jEJHHA.3872@.TK2MSFTNGP06.phx.gbl...
>
> Not sure about VB.NET, but in C# v2 you can do this simply by appending a
> question mark to the datatype e.g.
> Int32 intYear = 0; // not nullable
> Int32? intYear = null; // nullable
>
"Goofy" <me@.mine.com> wrote in message
news:%23r$GlYOJHHA.3264@.TK2MSFTNGP02.phx.gbl...
> Didnt know that, but then I dont code in C# normally.
Conversely, I never go anywhere near VB.NET... :-)
> This nullable facility is really usefull in some situations I find.
I couldn't agree more! One of the most important enhancements in v2, along
with generics.
0 comments:
Post a Comment