Results 1 to 5 of 5

Thread: Access System.Windows.Forms component

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2003
    Posts
    52

    Access System.Windows.Forms component

    Hi All,

    What's the different between a treeView declared like:

    Code:
    this.treeView1 = new System.Windows.Forms.TreeView();
    and a treeNode declared like:

    Code:
    System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Rond 1");
    I found out how to access the TreeNode:

    Code:
    TreeNode tn1 = this.treeView1.Nodes[0];
    But why can I access a node declared like this in a different class than the form class:

    Code:
    System.Windows.Forms.TreeNode treeNode666 = new System.Windows.Forms.TreeNode("Kalle");
    treeNode666.Text = "Stig";
    But not in the form class where the node is declared in the Form1.Designer.cs class like this:

    Code:
    System.Windows.Forms.TreeNode treeNode10 = new System.Windows.Forms.TreeNode("Rond 1");
    And I want to access the Node I as I did above:

    Code:
    treeNode10.Text = "Stig";
    Why does it work in the other class, but in the form class where I get 'The name 'treeNode10' does not exist in the current context' error?


    Regards

    Jonni
    Last edited by jonni; Dec 11th, 2006 at 05:33 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width