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. C#

C#

Scheduled Pinned Locked Moved C#
csharptutorial
15 Posts 7 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.
  • J Offline
    J Offline
    jojoba2010
    wrote on last edited by
    #1

    How to get all folders , subfolders and forms of my project !

    N D T 3 Replies Last reply
    0
    • J jojoba2010

      How to get all folders , subfolders and forms of my project !

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      You are risking being booted from this site. Read this and follow the guidelines. http://www.codeproject.com/Messages/1278604/How-to-get-an-answer-to-your-question.aspx[^]


      I know the language. I've read a book. - _Madmatt

      J 1 Reply Last reply
      0
      • N Not Active

        You are risking being booted from this site. Read this and follow the guidelines. http://www.codeproject.com/Messages/1278604/How-to-get-an-answer-to-your-question.aspx[^]


        I know the language. I've read a book. - _Madmatt

        J Offline
        J Offline
        jojoba2010
        wrote on last edited by
        #3

        WHY?:mad:

        L H realJSOPR 3 Replies Last reply
        0
        • J jojoba2010

          How to get all folders , subfolders and forms of my project !

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          If you feel the need to do something like this, you have a serious, serious design flaw in your application.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007, 2008
          But no longer in 2009...

          J 1 Reply Last reply
          0
          • D Dave Kreskowiak

            If you feel the need to do something like this, you have a serious, serious design flaw in your application.

            A guide to posting questions on CodeProject[^]
            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                 2006, 2007, 2008
            But no longer in 2009...

            J Offline
            J Offline
            jojoba2010
            wrote on last edited by
            #5

            I wanna this(all subfolders and forms) and fill in treeview and then when i click on any form in subfolder or anywhere it returns all controls in that form ! So who can i do that !?

            D 1 Reply Last reply
            0
            • J jojoba2010

              WHY?:mad:

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              jojoba2010 wrote:

              WHY?

              Your title means nothing and your question means little more. Try reading some books on C# and .NET, and doing some research, and then come back with a sensible question that refers to something you have actually done for yourself. If you are using these questions to learn how to write a program you are wasting everyone's time, including your own.

              MVP 2010 - are they mad?

              J 1 Reply Last reply
              0
              • J jojoba2010

                WHY?:mad:

                H Offline
                H Offline
                hammerstein05
                wrote on last edited by
                #7

                If you read the link provided, you would notice that, 1) your topic is less than clear 2) you're asking "how do I do this" without any comments on what you have tried so far etc. The forums are for assistance with what you're working on, not for people to give you the work. you should post, Topic: Subfolders and Files Content: I am working on a project to and I'm trying to figure out how to <>. I've tried x, y and z, but I've not had much luck. Can anybody see what I'm doing wrong, or point me in the right direction please?

                J 1 Reply Last reply
                0
                • L Lost User

                  jojoba2010 wrote:

                  WHY?

                  Your title means nothing and your question means little more. Try reading some books on C# and .NET, and doing some research, and then come back with a sensible question that refers to something you have actually done for yourself. If you are using these questions to learn how to write a program you are wasting everyone's time, including your own.

                  MVP 2010 - are they mad?

                  J Offline
                  J Offline
                  jojoba2010
                  wrote on last edited by
                  #8

                  If you think something like this ,I am sorry for you ? My Question : I wanna this(all subfolders and forms) and fill in treeview and then when i click on any form in subfolder or anywhere it returns all controls in that form ! So who can i do that !?

                  L 1 Reply Last reply
                  0
                  • H hammerstein05

                    If you read the link provided, you would notice that, 1) your topic is less than clear 2) you're asking "how do I do this" without any comments on what you have tried so far etc. The forums are for assistance with what you're working on, not for people to give you the work. you should post, Topic: Subfolders and Files Content: I am working on a project to and I'm trying to figure out how to <>. I've tried x, y and z, but I've not had much luck. Can anybody see what I'm doing wrong, or point me in the right direction please?

                    J Offline
                    J Offline
                    jojoba2010
                    wrote on last edited by
                    #9

                    Thanks dear ! SORry?! So whats you idea !? I have tried :

                    public void PopulateTree(string dir, TreeNode node)
                    {

                            // get the information of the directory
                    
                            DirectoryInfo directory = new DirectoryInfo(dir);
                    
                            // loop through each subdirectory
                    
                            foreach (DirectoryInfo d in directory.GetDirectories())
                            {
                    
                                if (d.Name != "bin" && d.Name != "obj" && d.Name != "Properties")
                                {
                                    // create a new node
                    
                                    TreeNode t = new TreeNode(d.Name);
                    
                                    // populate the new node recursively
                    
                                    PopulateTree(d.FullName, t);
                    
                                    node.Nodes.Add(t); // add the node to the "master" node
                                }
                    
                            }
                    
                            // lastly, loop through each file in the directory, and add these as nodes
                    
                            foreach (FileInfo f in directory.GetFiles())
                            {
                                string\[\] Count = f.Name.Split('.');
                    
                                // create a new node
                                if (Count.Length == 2 && f.Extension == ".cs" && f.Name != "Program.cs")
                                {
                                    TreeNode t = new TreeNode(f.Name);
                    
                                    // add it to the "master"
                    
                                    node.Nodes.Add(t);
                                }
                            }
                    
                        }
                    

                    private void btnGenerate_Click(object sender, EventArgs e)
                    {
                    treeView1.Nodes.Add("Resource Generator");
                    // PopulateTree(@"G:\Resource Final Editor For JahanBane\ResourceGenerator(FINISHED FINAL)\ResourceGenerator", treeView1.Nodes[0]);
                    PopulateTree(@"F:\AliWinTAP\WinTAP", treeView1.Nodes[0]);
                    }

                    1 Reply Last reply
                    0
                    • J jojoba2010

                      If you think something like this ,I am sorry for you ? My Question : I wanna this(all subfolders and forms) and fill in treeview and then when i click on any form in subfolder or anywhere it returns all controls in that form ! So who can i do that !?

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      jojoba2010 wrote:

                      If you think something like this ,I am sorry for you ?

                      Why be sorry for me, I have no problem? I was merely pointing out that the subject "C#" in your question tells us nothing. Try something like "Help with TreeView" as a more descriptive type. Also your question suggests that you need to study .NET and C# in more depth as your request is for a full function TreeView implementation which populates from a directory structure. This in itself is not that difficult if you try studying the control itself, or do a Google search, or take a look at the articles here on CodeProject.

                      MVP 2010 - are they mad?

                      1 Reply Last reply
                      0
                      • J jojoba2010

                        WHY?:mad:

                        realJSOPR Offline
                        realJSOPR Offline
                        realJSOP
                        wrote on last edited by
                        #11

                        Because...[^]

                        .45 ACP - because shooting twice is just silly
                        -----
                        "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
                        -----
                        "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001

                        1 Reply Last reply
                        0
                        • J jojoba2010

                          I wanna this(all subfolders and forms) and fill in treeview and then when i click on any form in subfolder or anywhere it returns all controls in that form ! So who can i do that !?

                          D Offline
                          D Offline
                          Dave Kreskowiak
                          wrote on last edited by
                          #12

                          Are you writing an AddIn for Visual Studio? Or are you trying to get all the form Name properties or your own application at runtime?

                          A guide to posting questions on CodeProject[^]
                          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                               2006, 2007, 2008
                          But no longer in 2009...

                          J 1 Reply Last reply
                          0
                          • D Dave Kreskowiak

                            Are you writing an AddIn for Visual Studio? Or are you trying to get all the form Name properties or your own application at runtime?

                            A guide to posting questions on CodeProject[^]
                            Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                 2006, 2007, 2008
                            But no longer in 2009...

                            J Offline
                            J Offline
                            jojoba2010
                            wrote on last edited by
                            #13

                            My own Application Only !?

                            D 1 Reply Last reply
                            0
                            • J jojoba2010

                              How to get all folders , subfolders and forms of my project !

                              T Offline
                              T Offline
                              ThatsAlok
                              wrote on last edited by
                              #14

                              use System.IO namespace DirectoryInfo,FileInfo and DriveInfo are the classes which can help

                              "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
                              Never mind - my own stupidity is the source of every "problem" - Mixture

                              cheers, Alok Gupta VC Forum Q&A :- I/IV Support CRY- Child Relief and You

                              1 Reply Last reply
                              0
                              • J jojoba2010

                                My own Application Only !?

                                D Offline
                                D Offline
                                Dave Kreskowiak
                                wrote on last edited by
                                #15

                                Since your project doesn't exist at runtime, there's no subfolders or form files or anything else. You'll have to use Reflection to find all of the classes that decend from the Form class. But, you have another problem. At runtime, the controls on a form do not exist until you create an instance of the form. ONLY then will they show up.

                                A guide to posting questions on CodeProject[^]
                                Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
                                     2006, 2007, 2008
                                But no longer in 2009...

                                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