Re: Function Warning - Null Reference
- From: "Terry" <new-grps@xxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 12 Jan 2007 00:25:05 -0000
Thanks Stephany,
I understand your explanation and what the warning is indicating. In order
to remove the warning I would need to ensure the function does not return a
null pointer. Is there a better syntax available giving a more complete
solution?
My experience comes from VBA and I have just started out in VB and .NET. The
structure and syntax is what I am trying to understand. The best way for me
is to have some good books, try converting some VBA code and visit these
newsgroups. Just wished I started 3 years ago.
Regards
<lord.zoltar@xxxxxxxxx> wrote in message
news:1168556090.645918.315190@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Stephany Young wrote:
Return hh & "h " & mm & "m " & ss & "s"
I don't know how much background you have in VB. I'll assume not much.
To clarify:
"Function 'Dec2hms' doesn't return a value on all code paths." means
that a function might not be returning a value along one of its
possible paths of execution, and that a line of code that calls the
function could get a Null Pointer from the function. In VB and VB.NET,
A Sub (Subroutine) is a procedure which never returns a value. A
Function is a procedure that MUST return a value.
To return a value from a function, use the keyword Return followed by
the value or variable that is being returned.
Placing
Return hh & "h " & mm & "m " & ss & "s"
at the end of the function (right above "end function") should fix the
problem.
.
- Follow-Ups:
- Re: Function Warning - Null Reference
- From: Stephany Young
- Re: Function Warning - Null Reference
- References:
- Function Warning - Null Reference
- From: Terry
- Re: Function Warning - Null Reference
- From: Stephany Young
- Re: Function Warning - Null Reference
- From: lord . zoltar
- Function Warning - Null Reference
- Prev by Date: Re: Single-threaded apartment?
- Next by Date: Re: Extracting data from an AS400 Database file
- Previous by thread: Re: Function Warning - Null Reference
- Next by thread: Re: Function Warning - Null Reference
- Index(es):
Relevant Pages
|