?
Solved

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

Posted on 2009-05-13
7
Medium Priority
?
268 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
[X]
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
  • 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:Christian de Bellefeuille
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
Christian de Bellefeuille earned 2000 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:Christian de Bellefeuille
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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month15 days, 2 hours left to enroll

771 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