• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 277
  • Last Modified:

don't understand this - System.Nullable(Of Integer))

Hi

I have a function automatically created for me by visual studio. the function includes this parameter

  ByRef JobID As System.Nullable(Of Integer))


This parameter is given a value during the function that i need to access. I don't understand what System.Nullable(Of Integer)) means

Please can you show me how i declare a variable that i can pass into this function and how i can then access its value

what does the system.nullable mean?

Thanks a lot
andrea
0
andieje
Asked:
andieje
1 Solution
 
PockyMasterCommented:
It's a brilliant feature:

it will allow you to check if a value is nothing which never really worked for value types like integer

So you can e.g. create a sub like

Public sub testing (testVal as System.Nullable(integer))

'try to see if it has a value
if testVal.HasValue then
messagebox.show ("so happy")
end if

end sub

call your sub like:
testing (nothing)
or testing (1)

in your sub you can get the value like
testVal.Value
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now