System.NullReferenceException

3 posts, 0 answers
  1. Karl Golling
    Karl Golling avatar
    226 posts
    Member since:
    Jun 2005

    Posted 15 May 2010 Link to this post

    I have a form in a WindowsApplication with just a RadTreeNode on it.


    Imports System  
    Imports Telerik.WinControls.UI  
     
    Public Class Form1  
        Inherits Form  
        Private Sub Form1_Load(ByVal sender As System.ObjectByVal e As System.EventArgs) Handles MyBase.Load  
            InitializeComponent()  
     
            Dim node As RadTreeNode = RadTreeView1.Nodes("Email Contacts").Nodes.Add("Bob Tony")  
            node.Selected = True 
            RadTreeView1.Nodes("Email Contacts").Nodes.Add("Sue Winchell")  
            RadTreeView1.Nodes("Email Contacts").Nodes.Add("Lui Sang")  
            RadTreeView1.Nodes("Lists").Nodes.Add("Priorities")  
            RadTreeView1.Nodes("Lists").Nodes.Add("Opportunities")  
            RadTreeView1.Nodes("Lists").Nodes.Add("Issues")  
        End Sub 
    End Class 

    This is from your example.
    On reaching this line:
            Dim node As RadTreeNode = RadTreeView1.Nodes("Email Contacts").Nodes.Add("Bob Tony")  
    I keep getting the error:
    System.NullReferenceException was unhandled
      Message="Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt."

    What's happening and how do I correct it?

    Thanks in advance
    Karl
     
  2. Karl Golling
    Karl Golling avatar
    226 posts
    Member since:
    Jun 2005

    Posted 16 May 2010 Link to this post

    Found it.
    RadTreeView1.Nodes("Email Contacts"). doesn't exist - fist has to be added.
    and
    InitializeComponent()
    was disturbing
    thanks anyway
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 19 May 2010 Link to this post

    Hello Karl,

    It is great that you managed to find a solution.
    Write again if you have other questions.

    Sincerely yours,
    Victor
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Back to Top