0

I'm trying to pass "Nothing" to a parameter in Vb.NET ( using VS 2010 with everything to default )

The code is like this:

Public Property status As statusEvidenta
  <DebuggerNonUserCode()> _
  Get
    Me.m_status = Nothing
    Me.m_status = MyForms.Create__Instance__(Of statusEvidenta)(Nothing) 

where :

Public m_status As statusEvidenta

and :

Private Shared Function Create__Instance__(Of T As {System.Windows.Forms.Form, New})(ByRef Instance As T) As T
  Dim v_genericMethodVar As T
  If ((Not Instance Is Nothing) AndAlso Not Instance.IsDisposed) Then
    Return Instance
  End If

I'm not familiar with VB.NET but why can't I just pass a Nothing parameter ? In c++ you can pass a NULL , is this not possible here ?

I get the following errors:

Additional information: Object reference not set to an instance of an object.

mcirsta
  • 13
  • 1
  • 5
  • The issue is not with passing of a `null` value (`Nothing` in VB.NET), but trying to call a member on it. – Oded Feb 05 '12 at 21:23
  • 1
    Hmm, you are using source code you got from a disassembler. What's the hangup here? If you obtained a license to use the assembly then you shouldn't have any trouble getting help from the owner to use it properly. Asking for help breaking copyright law isn't otherwise very appropriate here. – Hans Passant Feb 05 '12 at 21:28
  • Yes , should have mentions about that. Code is for a friend. She had the program made for her by a former friend of hers. Now they're not anymore so she can't ask for the code and she needs modifications to it. – mcirsta Feb 05 '12 at 21:31
  • Replacing Me.m_status = Nothing with Me.m_status = New statusEvidenta works though... Which is strange as I don't seem to call any methods on m_status – mcirsta Feb 05 '12 at 21:42
  • Mistery solved, damn dissassembler ( Reflector ) was adding DebugHidden flags so I missed the problem. – mcirsta Feb 05 '12 at 22:09

0 Answers0