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

Posted on 2009-05-13
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).
Question by:David L. Hansen
  • 3
  • 3
LVL 13

Expert Comment

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

LVL 10

Expert Comment

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...
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.




Public Sub RequestNode(ByVal AppRow As DataRow, ByRef tree As TreeView)



Open in new window

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

LVL 10

Accepted Solution

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...
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
LVL 10

Expert Comment

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

Author Comment

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

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This video discusses moving either the default database or any database to a new volume.
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

743 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now