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. Managed C++/CLI
  4. delete all label in windows form CLI

delete all label in windows form CLI

Scheduled Pinned Locked Moved Managed C++/CLI
questiontutorial
12 Posts 2 Posters 4 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.
  • L Lost User

    Please do not repost. I gave you a suggestion to your original question.

    T Offline
    T Offline
    TheCaptain10
    wrote on last edited by
    #3

    Unfortunately I don't understand your suggestion. Please explain more and give me a example. Thanks.

    L 1 Reply Last reply
    0
    • T TheCaptain10

      Unfortunately I don't understand your suggestion. Please explain more and give me a example. Thanks.

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

      See http://stackoverflow.com/questions/15186828/loop-through-all-controls-on-a-form-even-those-in-groupboxes[^]. It's C# but the principle is the same.

      T 1 Reply Last reply
      0
      • L Lost User

        See http://stackoverflow.com/questions/15186828/loop-through-all-controls-on-a-form-even-those-in-groupboxes[^]. It's C# but the principle is the same.

        T Offline
        T Offline
        TheCaptain10
        wrote on last edited by
        #5

        Exactly I don'n know what I write. I barely know about windows form because I just start it. if you know equivalent of that code in c++,please help me.

        L 1 Reply Last reply
        0
        • T TheCaptain10

          Exactly I don'n know what I write. I barely know about windows form because I just start it. if you know equivalent of that code in c++,please help me.

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

          If you are just starting Windows Forms you may find it easier to switch to C#. For a sample of C++ referencing Form Controls see https://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1[^].

          T 1 Reply Last reply
          0
          • L Lost User

            If you are just starting Windows Forms you may find it easier to switch to C#. For a sample of C++ referencing Form Controls see https://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls(v=vs.110).aspx?cs-save-lang=1&cs-lang=cpp#code-snippet-1[^].

            T Offline
            T Offline
            TheCaptain10
            wrote on last edited by
            #7

            Tank you but still there is a problem! I don't access label name because it made dynamically and before that i cant access to this label. Even I know label name the compiler don't allow me to remove in that way.

            L 1 Reply Last reply
            0
            • T TheCaptain10

              Tank you but still there is a problem! I don't access label name because it made dynamically and before that i cant access to this label. Even I know label name the compiler don't allow me to remove in that way.

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

              Sorry, but I do not understand what you mean. If you are iterating through a collection of controls then you do not need their name. As you look at each control in the collection you get its type to check if it is a label. Then you read its content to see if it is one of the candidates for deletion.

              T 1 Reply Last reply
              0
              • L Lost User

                Sorry, but I do not understand what you mean. If you are iterating through a collection of controls then you do not need their name. As you look at each control in the collection you get its type to check if it is a label. Then you read its content to see if it is one of the candidates for deletion.

                T Offline
                T Offline
                TheCaptain10
                wrote on last edited by
                #9

                Well,how can I get the controls type? is there any function to return this? And how I check it is label or not?

                L 1 Reply Last reply
                0
                • T TheCaptain10

                  Well,how can I get the controls type? is there any function to return this? And how I check it is label or not?

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

                  Go back to the link I gave you previously and study the documentation.

                  T 1 Reply Last reply
                  0
                  • L Lost User

                    Go back to the link I gave you previously and study the documentation.

                    T Offline
                    T Offline
                    TheCaptain10
                    wrote on last edited by
                    #11

                    I read them but they code are in c# and I don't know equivalent of this part in c++ : " C.GetType() == typeof(System.Windows.Forms.TextBox) " c.GetType exist in c++ but "typeof(System.Windows.Forms.TextBox)" no,do you know what is it in c++? (I'm sorry that I ask a lot question.)

                    L 1 Reply Last reply
                    0
                    • T TheCaptain10

                      I read them but they code are in c# and I don't know equivalent of this part in c++ : " C.GetType() == typeof(System.Windows.Forms.TextBox) " c.GetType exist in c++ but "typeof(System.Windows.Forms.TextBox)" no,do you know what is it in c++? (I'm sorry that I ask a lot question.)

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

                      I have not tried this but you should be able to use the GetType method[^] and compare it against the same result from a known object of that class, something like:

                      Label ll = new Label();
                      if (control.GetType() == ll.GetType())
                      // ...

                      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