473,387 Members | 1,891 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Passing an array to Tag property

Ant
Hi,

I'm using the tag property of the Treenode object to store an string array
containing some values. I can assign it to the Tag but when I try to retrieve
values from it I get an error: "Object reference not set to object"

This is what i'm doing below:

// retrieve the array from the treenode tag property
memberInfo = (string[])tn.Tag;

// Try to display the first element. Get error here.
Debug.Assert(false,memberInfo[0]);

What is causing this error?
Any ideas are appreciated

Thanks very much in advance
Ant


Jul 11 '06 #1
3 6089
Your StringArray seems to be empty.... or no StringArray are assigned to the
node "tn"...
You should give us the code where you assign the StringArray to the Tag
property....

Steph.
"Ant" <An*@discussions.microsoft.comwrote in message
news:B9**********************************@microsof t.com...
Hi,

I'm using the tag property of the Treenode object to store an string array
containing some values. I can assign it to the Tag but when I try to
retrieve
values from it I get an error: "Object reference not set to object"

This is what i'm doing below:

// retrieve the array from the treenode tag property
memberInfo = (string[])tn.Tag;

// Try to display the first element. Get error here.
Debug.Assert(false,memberInfo[0]);

What is causing this error?
Any ideas are appreciated

Thanks very much in advance
Ant


Jul 11 '06 #2
Ant
Thanks for the reply TheSteph,

This is how I'm filling the array & assigning it to the Tag property:

// Create & fill array
string[] memberDetails = { familyMember.MemberName,
familyMember.Gender, familyMember.MaritalStatus };

// Assign array to Tag property
nodeMember.Tag = memberDetails;
I have also done the same thing using a struct instead of an array but I get
the same error.

Hope this helps you help me ;)

Thanks for your time on this
Ant

"TheSteph" wrote:
Your StringArray seems to be empty.... or no StringArray are assigned to the
node "tn"...
You should give us the code where you assign the StringArray to the Tag
property....

Steph.
"Ant" <An*@discussions.microsoft.comwrote in message
news:B9**********************************@microsof t.com...
Hi,

I'm using the tag property of the Treenode object to store an string array
containing some values. I can assign it to the Tag but when I try to
retrieve
values from it I get an error: "Object reference not set to object"

This is what i'm doing below:

// retrieve the array from the treenode tag property
memberInfo = (string[])tn.Tag;

// Try to display the first element. Get error here.
Debug.Assert(false,memberInfo[0]);

What is causing this error?
Any ideas are appreciated

Thanks very much in advance
Ant




Jul 12 '06 #3
Ant
Hi The Steph,

You were correct. As the loop iterated through, some elements were empty.

Thanks very much for your help.

Ant

"TheSteph" wrote:
Your StringArray seems to be empty.... or no StringArray are assigned to the
node "tn"...
You should give us the code where you assign the StringArray to the Tag
property....

Steph.
"Ant" <An*@discussions.microsoft.comwrote in message
news:B9**********************************@microsof t.com...
Hi,

I'm using the tag property of the Treenode object to store an string array
containing some values. I can assign it to the Tag but when I try to
retrieve
values from it I get an error: "Object reference not set to object"

This is what i'm doing below:

// retrieve the array from the treenode tag property
memberInfo = (string[])tn.Tag;

// Try to display the first element. Get error here.
Debug.Assert(false,memberInfo[0]);

What is causing this error?
Any ideas are appreciated

Thanks very much in advance
Ant




Jul 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ryan Malone | last post by:
Passing Dictionary object byref Ive created an ASP class that uses a dictionary object which is filled from a recordset. It passes the object to the propterty of another ASP class byref: ...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
2
by: craigkenisston | last post by:
Hi, I created an array of objects like this : object Values = {myObject.myprop, otherobject.otherprop, thirdobject.xprop}; Then I pass it to a method. and I get the values filled in that...
6
by: ged | last post by:
Hi, i am a oo (c#) programmer, and have not used javascript for a while and i cant work out how javascript manages its references. Object References work for simple stuff, but once i have an...
1
by: kmercer46 | last post by:
have a class that contains an array and i would like to access the individual array elements in a form. I understand that VB.net does not allow the array to be public and i think i need to pass it...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
7
by: David Lowndes | last post by:
The following example illustrates something that's taken me a while to suss out (debugging someone else's code :( )... The crux is that the code compiles cleanly at W4, and the issue is that I'm...
1
by: aeshiels | last post by:
Hopefully I have the correct newsgroup for this question. I've developed a very simple COM server in C++ as im trying to learn COM. The COM server has an array of IUnknown interfaces (MyArray)...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.