Solved

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

Posted on 2009-05-13
7
264 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
Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

 
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

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

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

Suggested Solutions

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…
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…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

777 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