Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Treeview problem!!!

Treeview problem!!!

Scheduled Pinned Locked Moved C#
data-structureshelptutorialquestion
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neo Andreson
    wrote on last edited by
    #1

    My tree view generation is happening inside InitilizeComponent() it's System.Windows.Forms.TreeNode is local to InitilizeComponent() I want to make it's TreeNode private member variable of the same class. I did it is working fine but after any modification in GUI it is changing automatically. How to stop that??

    Truth Is The Simplest !!!!

    D L 2 Replies Last reply
    0
    • N Neo Andreson

      My tree view generation is happening inside InitilizeComponent() it's System.Windows.Forms.TreeNode is local to InitilizeComponent() I want to make it's TreeNode private member variable of the same class. I did it is working fine but after any modification in GUI it is changing automatically. How to stop that??

      Truth Is The Simplest !!!!

      D Offline
      D Offline
      DaveyM69
      wrote on last edited by
      #2

      Don't alter anything inside the InitializeComponent section as it's likely to get changed. Make any alterations outside of that method (in the constructor after the InializeComponent(); if you like).

      Dave

      1 Reply Last reply
      0
      • N Neo Andreson

        My tree view generation is happening inside InitilizeComponent() it's System.Windows.Forms.TreeNode is local to InitilizeComponent() I want to make it's TreeNode private member variable of the same class. I did it is working fine but after any modification in GUI it is changing automatically. How to stop that??

        Truth Is The Simplest !!!!

        L Offline
        L Offline
        LongRange Shooter
        wrote on last edited by
        #3

        InitializeComponent() is clearly marked as being generated code that should not be modified. You should slap yourself for doing such a move. In your main code, you need to create your tree separately following the call to InitializeComponent(). I typically write a method for my own initialization and call it Initialize{something} --> in your case InitializeTreeview(); Then write that as part of your forms mainline code. Stay out of the designer. Don't ever touch it again. Or some midgit will be sent from the Programmer Police and he will slap your kneecaps silly.

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups