Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Error of "Object reference not set" occurs while passing two valid/instantiated objects.

Posted on 2009-05-13
7
265 Views
Last Modified: 2012-05-06
I'm executing a custom method which calls for two objects, one ByVal and the other ByRef.  Both values are properly instantiated (and have data in them) at the moment the method is being called (debug mode shows this).  Why would this error occur??

Note: the objects are a dataRow (byval), and a treeview (byref).
0
Comment
Question by:David L. Hansen
  • 3
  • 3
7 Comments
 
LVL 13

Expert Comment

by:Michael_D
ID: 24379827
can you post the line of code where you get the error?

0
 
LVL 10

Expert Comment

by:cdebel
ID: 24379839
can you show how you call this method?
can you show how this method is defined?
Have you really placed a breakpoint on the first line of the method to make sure that what you receive is really instanciated?
Does all the properties of theses instances are also instanciated?...

I've never seen a case where "Object reference not set" is given and that everything is properly instanciated...
0
 
LVL 15

Author Comment

by:David L. Hansen
ID: 24379925
Code is as follows:

I can see the data inside of "row" when I hover over it in debug-mode and the tree's name, etc. when I hover over it.  They have the right data in them.
Friend Class ModeController
Private tree As TreeView
Public Sub New(ByRef dataClass As DataClass, ByRef aTreeView As TreeView)
     dbTool = dataClass
     tree = aTreeView
End Sub
.
.
'below is in another method called chooseMode()
For Each row In dtLinkedApps.Rows
     appTool.RequestNode(row, tree) 'THIS IS THE LINE THAT FAILS.
Next
.
.
Public Sub RequestNode(ByVal AppRow As DataRow, ByRef tree As TreeView)
.
.

Open in new window

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 10

Accepted Solution

by:
cdebel earned 500 total points
ID: 24379937
On which line this error happen?  11? (in the code snipet i mean)
Or in your RequestNode method?

If it's on Line 11, then appTools is not instanciated.
If its in RequestNode, then we need the code for RequestNode...
0
 
LVL 15

Author Comment

by:David L. Hansen
ID: 24379977
Boy am I blind!!! :)

It was appTool that was uninstantiated, not the parameters....sigh..perhaps I need to clear my head)!

Thanks cdebel
0
 
LVL 10

Expert Comment

by:cdebel
ID: 24379983
lol.  Don't worry, it happenned to me too
0
 
LVL 15

Author Comment

by:David L. Hansen
ID: 24379995
Sometimes ya just gotta laugh ;)
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

828 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question