Warning - doesn't return a value

I just converted a solution from VB.Net 2003 to VB 2005 and received many Warnings all the same.Here's a sample code:[code]Public Property LengthLabel() As Label Get End Get Set(ByVal LengthLabel As Label) LengthLbl = LengthLabel End SetEnd Property[/code]The 'Get - End Get' was added during conversion and this is the Warning:

[color=Red]Warning 82 Property 'LengthLabel' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.[/color]

Comments

: Hello,: : I just converted a solution from VB.Net 2003 to VB 2005 and received : many Warnings all the same.: Here's a sample code:: [code]: : Public Property LengthLabel() As Label: Get: End Get: Set(ByVal LengthLabel As Label): LengthLbl = LengthLabel: End Set: End Property: [/code]: : The 'Get - End Get' was added during conversion and this is the : Warning:: : [color=Red]Warning 82 Property 'LengthLabel' doesn't return a value : on all code paths. A null reference exception could occur at run : time when the result is used.[/color]: : What is required to correct this Warning?: Thank you.: You need to fill in the body of the Get part of the declaration.

: : Hello,: : : : I just converted a solution from VB.Net 2003 to VB 2005 and received : : many Warnings all the same.: : Here's a sample code:: : [code]: : : : Public Property LengthLabel() As Label: : Get: : End Get: : Set(ByVal LengthLabel As Label): : LengthLbl = LengthLabel: : End Set: : End Property: : [/code]: : : : The 'Get - End Get' was added during conversion and this is the : : Warning:: : : : [color=Red]Warning 82 Property 'LengthLabel' doesn't return a value : : on all code paths. A null reference exception could occur at run : : time when the result is used.[/color]: : : : What is required to correct this Warning?: : Thank you.: : : You need to fill in the body of the Get part of the declaration.

Fill it in with what?I can't find any help on what this 'Get - End Get' is!Can I just use some dummy statement like -Return(0)- ?What would you suggest?

: : : Hello,: : : : : : I just converted a solution from VB.Net 2003 to VB 2005 and received : : : many Warnings all the same.: : : Here's a sample code:: : : [code]: : : : : : Public Property LengthLabel() As Label: : : Get: : : End Get: : : Set(ByVal LengthLabel As Label): : : LengthLbl = LengthLabel: : : End Set: : : End Property: : : [/code]: : : : : : The 'Get - End Get' was added during conversion and this is the : : : Warning:: : : : : : [color=Red]Warning 82 Property 'LengthLabel' doesn't return a value : : : on all code paths. A null reference exception could occur at run : : : time when the result is used.[/color]: : : : : : What is required to correct this Warning?: : : Thank you.: : : : : You need to fill in the body of the Get part of the declaration.: : Fill it in with what?: I can't find any help on what this 'Get - End Get' is!: Can I just use some dummy statement like -Return(0)- ?: What would you suggest?: The Get part is the part, which returns the value of the property. Thus if you have this statement:[code] MyLabel = SomeObject.LengthLabel();[/code]MyLabel holds the value of the LengthLabel as set by the Set-part of your property.