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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S0NCVERldg==?=

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

    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?
  • =?Utf-8?B?cnViZW4=?=

    #2
    RE: Beginner and trying to get the tag value of a treeview.select ednod

    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?

    Comment

    Working...