edit nodes properties in run-time

5 posts, 1 answers
  1. memol
    memol avatar
    4 posts
    Member since:
    Nov 2008

    Posted 04 Feb 2009 Link to this post

    Hi
    I want to edit nodes.text or nodes.font in run time ! but when i try to it got error .
    whats the problem ?

    treeview1.Nodes("node1").Font.Bold = False

    please help me
  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 05 Feb 2009 Link to this post

    Hi memol,
     
    Thank you for writing.
     
    You should not try to assign values to the Font.Bold property as it is readonly. Instead create a new Font object like so:
     
    radTreeView1.Nodes["Some node"].Font = new Font("Arial", 8, FontStyle.Regular);
     
     
    I hope this answers your question. Please write back if you have more questions.
     

    Regards,
    Victor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. memol
    memol avatar
    4 posts
    Member since:
    Nov 2008

    Posted 05 Feb 2009 Link to this post

    Hi
    thanks dear for reply :)

    in this way i can edit nodes properties via index or nodes text. how can i access to these property by nodes.name ?

    working  with index decrease code-readability  . and working with node.text is not suitable for me (node.text maybe changed more time in run-time")

    how to access to nodes by names ?
  5. Answer
    Victor
    Admin
    Victor avatar
    1351 posts

    Posted 06 Feb 2009 Link to this post

    Hi memol,

    Thank you for writing.
    You can search by name using RadTreeNodeCollection's Find() method, it returns an array of found nodes. You can use it like so:
    private void radButton1_Click(object sender, EventArgs e)  
    {  
        // The second argument indicates whether to search recursively.  
        RadTreeNode[] foundNodes = radTreeView1.Nodes.Find("SomeNode"true);  
        MessageBox.Show(foundNodes[0].Text);  
    I hope this is what you are looking for. Please write back if you have other questions.

    Best wishes,
    Victor
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  6. memol
    memol avatar
    4 posts
    Member since:
    Nov 2008

    Posted 08 Feb 2009 Link to this post

    Hi
    Thanks . :)

Back to Top
UI for WinForms is Visual Studio 2017 Ready