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. Can you use Forms Designer to index controls?

Can you use Forms Designer to index controls?

Scheduled Pinned Locked Moved Managed C++/CLI
csharpc++databasevisual-studioquestion
7 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.
  • B Offline
    B Offline
    BuckBrown
    wrote on last edited by
    #1

    Hi, I'm using Visual Studio 2005 C++/CLI. I have a data entry Form that has 50 TextBox controls. The Forms Designer gives these controls the names textBox1, textBox2,.....textBox50. When I check to make sure none of the fields are null I have to write code for each of the 50 controls. It would be nice if I could loop through textBox(n) controls. Is there any way to do this? Thanks Buck

    M L 2 Replies Last reply
    0
    • B BuckBrown

      Hi, I'm using Visual Studio 2005 C++/CLI. I have a data entry Form that has 50 TextBox controls. The Forms Designer gives these controls the names textBox1, textBox2,.....textBox50. When I check to make sure none of the fields are null I have to write code for each of the 50 controls. It would be nice if I could loop through textBox(n) controls. Is there any way to do this? Thanks Buck

      M Offline
      M Offline
      Mark Salsbery
      wrote on last edited by
      #2

      I don't do any forms coding, but can you iterate through the control collection for the form and look for TextBox controls? Something like:

      for each (Control control in form->Controls)
      {
      if (nullptr != dynamic_cast<textbox>(control))
      {
      ...
      }
      }

      Mark

      Mark Salsbery Microsoft MVP - Visual C++ :java:

      modified on Tuesday, June 17, 2008 6:25 PM

      L 1 Reply Last reply
      0
      • B BuckBrown

        Hi, I'm using Visual Studio 2005 C++/CLI. I have a data entry Form that has 50 TextBox controls. The Forms Designer gives these controls the names textBox1, textBox2,.....textBox50. When I check to make sure none of the fields are null I have to write code for each of the 50 controls. It would be nice if I could loop through textBox(n) controls. Is there any way to do this? Thanks Buck

        L Offline
        L Offline
        led mike
        wrote on last edited by
        #3

        BuckBrown wrote:

        I have a data entry Form that has 50 TextBox controls.

        BuckBrown wrote:

        It would be nice if I could loop through textBox(n) controls.

        Ok, but wouldn't it be better if you didn't have 50 textbox controls that you had to loop through? Alternative User Interface designs could eliminate that and simultaneously offer a better experience for the user.

        led mike

        1 Reply Last reply
        0
        • M Mark Salsbery

          I don't do any forms coding, but can you iterate through the control collection for the form and look for TextBox controls? Something like:

          for each (Control control in form->Controls)
          {
          if (nullptr != dynamic_cast<textbox>(control))
          {
          ...
          }
          }

          Mark

          Mark Salsbery Microsoft MVP - Visual C++ :java:

          modified on Tuesday, June 17, 2008 6:25 PM

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          LMAO did you see my post got voted a '1'? This place is really starting to suck dude.

          led mike

          M 1 Reply Last reply
          0
          • L led mike

            LMAO did you see my post got voted a '1'? This place is really starting to suck dude.

            led mike

            M Offline
            M Offline
            Mark Salsbery
            wrote on last edited by
            #5

            Yeah :sigh: I try to ignore all the voting stuff, but I do notice stupid stuff like that.

            Mark Salsbery Microsoft MVP - Visual C++ :java:

            L 1 Reply Last reply
            0
            • M Mark Salsbery

              Yeah :sigh: I try to ignore all the voting stuff, but I do notice stupid stuff like that.

              Mark Salsbery Microsoft MVP - Visual C++ :java:

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              Fuck um, I'm going to start voting all the idiot questions a '1', I'm on a mission.

              led mike

              M 1 Reply Last reply
              0
              • L led mike

                Fuck um, I'm going to start voting all the idiot questions a '1', I'm on a mission.

                led mike

                M Offline
                M Offline
                Mark Salsbery
                wrote on last edited by
                #7

                Well you've got your work cut out for you ;)

                Mark Salsbery Microsoft MVP - Visual C++ :java:

                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