473,398 Members | 2,335 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,398 software developers and data experts.

Beginner and trying to get the tag value of a treeview.selectednod

I am trying to do this line of code:
txtBxMessageBody.Text = ".\\ " + treeView1.SelectedNode.Tag.ToString();

I am getting an error back. It is something pretty simple but I can't
figure it out.
The error is: System.NullReferenceException: Object reference not set to an
instance of an object at myMethod

This is the only line of code in the method and when I only add a string to
the .Text value it runs fine.

Any ideas?
Apr 4 '08 #1
1 1464
either the tree view do not has a node selected (treeView1.SelectedNode ==
null)
or the tag property is not set (treeView1.SelectedNode.Tag == null)

"KCBTDev" wrote:
I am trying to do this line of code:
txtBxMessageBody.Text = ".\\ " + treeView1.SelectedNode.Tag.ToString();

I am getting an error back. It is something pretty simple but I can't
figure it out.
The error is: System.NullReferenceException: Object reference not set to an
instance of an object at myMethod

This is the only line of code in the method and when I only add a string to
the .Text value it runs fine.

Any ideas?
Apr 4 '08 #2

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

Similar topics

2
by: Norman Fritag | last post by:
Hi there, I have a <a href "JavaScript:t('1')"> event that expands and collapse hyperlinks, similar to a treeview (<div>). The webpage is split in Left and right side. The "treeview" resides...
0
by: meh | last post by:
Still have not been able to convert this. More importently.....Is this sample going about it the right way??? tia meh Here is the vb code.........I keep looking at older vb.net projects to...
3
by: Mark | last post by:
I've been writing code in VB and VBScript for several years and I'm finally caving in to .net! I've decided to work with C# as I've always understood the basic concepts of C/C++ but never gained...
1
by: Maileen | last post by:
Hi, I have a TabControl with 2 TabPages (TabPage1 and TabPage2). I have a TreeView control with 2 nodes (Page1 and Page2). When i click on Page1 node, I want to display the TabPage1...the same...
8
by: jimscott77 | last post by:
Can someone help with the following problem TextBox1 is bound to a dataset and shows a value of "5" I am trying to use that value as follows Variable1 = Val(TextBox1.Text) The result that...
8
by: jimscott77 | last post by:
Can someone help with the following problem? Original Question: TextBox1 is bound to a dataset and at runtime shows a value of "5" I am trying to use that value as follows: TextBoxA.Text =...
2
by: Jack | last post by:
Hello, I am trying use a TreeView with checkboxes. I would like to check more than one node and allow all child nodes of selected nodes to be checked or unchecked with the parent is checked. ...
3
by: jesper_lofgren | last post by:
Hi, I have two usercontrols one menu control that use ASP.NET 2.0 Treeview control, then a main usercontrol for showing the selected URL in a Iframe. The problem is when i raise the...
0
by: Henry | last post by:
I am trying to create a TreeView control that works with an ADO Dataset DataTable or the new BindingSource stuff in .NET 2.0 to build a Treeview that is populated. This is what I came up with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.