Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2009-05-13
7
Medium Priority
?
269 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

597 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