Re: Beginner level VB.NET question
- From: OregonMike <OregonMike@xxxxxxxxx>
- Date: Thu, 27 Sep 2007 13:00:43 -0700
On Sep 27, 12:10 pm, Anand[MVP] <Anand...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
As such the code seems OK, but I just want to check, as you did mention you
were a C# programmer. VB is not case sensitive. So are you just setting the
object to nothing somewhere in the code, but not realizing it is the same
object?
--
Rgds,
Anand
VB.NET MVPhttp://www.dotnetindia.com
"OregonMike" wrote:
I'm a C# guy tasked with fixing some bugs in VB.NET code. I've run
into something that doesn't seem to make sense. I have an Object
reference to a System.Windows.Forms.ToolStripComboBox Object that gets
initialized and performs just fine. Now, when closing the app, this
object gets Disposed. I'm trying to check whether this object is null
(Nothing, I presume) before calling one of its Properties. It seems
pretty simple, but the test for Nothing always fails claiming it's not
Nothing. Then trying to access one of its Properties results in an
NullReferenceException ;( Am I checking whether my reference Object is
null correctly?
Example:
' global scope
Dim cB As ToolStripComboBox
..
..
' Initialization and other good stuff
..
..
' Futhur down in its own Sub
..
If Not cB Is Nothing
cB.SelectedIndex = 1
End If
The object isn't set to Nothing anywhere else. I'm wondering if the
object is in an inconsistent state or if the debugger is buggy.
.
- References:
- Beginner level VB.NET question
- From: OregonMike
- Beginner level VB.NET question
- Prev by Date: Re: Memory...issues
- Next by Date: Re: Beginner level VB.NET question
- Previous by thread: Re: Beginner level VB.NET question
- Next by thread: Re: Beginner level VB.NET question
- Index(es):
Relevant Pages
|