473,800 Members | 2,507 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

I am trying to do this line of code:
txtBxMessageBod y.Text = ".\\ " + treeView1.Selec tedNode.Tag.ToS tring();

I am getting an error back. It is something pretty simple but I can't
figure it out.
The error is: System.NullRefe renceException: 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 1472
either the tree view do not has a node selected (treeView1.Sele ctedNode ==
null)
or the tag property is not set (treeView1.Sele ctedNode.Tag == null)

"KCBTDev" wrote:
I am trying to do this line of code:
txtBxMessageBod y.Text = ".\\ " + treeView1.Selec tedNode.Tag.ToS tring();

I am getting an error back. It is something pretty simple but I can't
figure it out.
The error is: System.NullRefe renceException: 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
2257
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 on the left and the contents gets displayed on the right side. Everytime the JavaScript:t('1') is clicked the section below is displayed. The text of the JavaScript hyperlink is at the top similar to a header. When I click on the hyperlinks in...
0
3446
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 try and figure out how to teach myself C# based on my old vb code but it's been more difficult than I first thought. I'm finding that it would be better if didn't know any previous programming language.
3
1174
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 much experience in writing actual code. I'm trying to work out the best way to implement a class to meet the following requirements. I have three types of object, lets call them Object1,
1
911
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 thing for Page2 node (TabPage2). This is easy to do using selectedIndex = ...
8
3718
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 I'd expect is that Variable1 would equal 5. The result that I get is that Variable1 equals 0
8
1591
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 = TextBox1.Text The result that I'd expect is that TextBoxA.Text would equal 5. The result that I get is that TextBoxA.Text equals "", or wit a Val(function) it equals 0.
2
22063
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. Thanks in advance for any help, Jack
3
2402
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 OnSelectedNodeChanged on the menu and add the URL value into a session or Viewstate key and collect the value on the second (main usercontrol) the value is always i step behind the actual click value ?
0
1643
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 so far... I can't run it yet because I don't have the DataTable source... I still want to get some sort of assessment as to whether I am heading in the right direction. Here is the code: ================================ using System;
0
10504
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10274
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9085
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7576
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6811
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5469
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.