Clear Multiple controls at the same time

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eduardo78

    #1

    Clear Multiple controls at the same time

    Hello everybody,

    I heard I could clear (or move spaces) to all controls at ones without
    having to call each one of them. If someone remembers how to do that, I will
    apreciate your help.

    My scenario is a form where I have multiples groupboxes, and in each of
    those groups i have text boxes, where users enter data. And I want to have
    an option where the user can clear the controls in particular group at once.
    And I do not want to be calling for each one of the controls for that
    process.
    I used to move spaces to each one of them like this:

    text1.text = ""
    text2.text=""
    text3.text = ""
    ....
    textn.text = ""

    but there are a lot of controls in this application.


    Thanks for any good suggestions.

    Edd
  • Chris

    #2
    Re: Clear Multiple controls at the same time

    Eduardo78 wrote:[color=blue]
    > Hello everybody,
    >
    > I heard I could clear (or move spaces) to all controls at ones without
    > having to call each one of them. If someone remembers how to do that, I will
    > apreciate your help.
    >
    > My scenario is a form where I have multiples groupboxes, and in each of
    > those groups i have text boxes, where users enter data. And I want to have
    > an option where the user can clear the controls in particular group at once.
    > And I do not want to be calling for each one of the controls for that
    > process.
    > I used to move spaces to each one of them like this:
    >
    > text1.text = ""
    > text2.text=""
    > text3.text = ""
    > ...
    > textn.text = ""
    >
    > but there are a lot of controls in this application.
    >
    >
    > Thanks for any good suggestions.
    >
    > Edd[/color]

    For each Ctr as Control in GroupBox.Contro ls
    Ctr.Text = ""
    Next

    This should work.
    Chris

    Comment

    • Curtis

      #3
      Re: Clear Multiple controls at the same time

      Eduardo,

      Try this where "me" is your form:

      Me.Controls.Cle ar()

      Curtis

      "Eduardo78" <Eduardo78@disc ussions.microso ft.com> wrote in message
      news:BDB1BE20-5876-4E9B-9447-1D4B1882CFB8@mi crosoft.com...[color=blue]
      > Hello everybody,
      >
      > I heard I could clear (or move spaces) to all controls at ones without
      > having to call each one of them. If someone remembers how to do that, I
      > will
      > apreciate your help.
      >
      > My scenario is a form where I have multiples groupboxes, and in each of
      > those groups i have text boxes, where users enter data. And I want to
      > have
      > an option where the user can clear the controls in particular group at
      > once.
      > And I do not want to be calling for each one of the controls for that
      > process.
      > I used to move spaces to each one of them like this:
      >
      > text1.text = ""
      > text2.text=""
      > text3.text = ""
      > ...
      > textn.text = ""
      >
      > but there are a lot of controls in this application.
      >
      >
      > Thanks for any good suggestions.
      >
      > Edd[/color]


      Comment

      • Eduardo78

        #4
        Re: Clear Multiple controls at the same time

        Thanks a lot Chris, it worked good, but it also cleared the labels on that
        groupbox, how could I make it to clear just the textboxes?

        "Chris" wrote:
        [color=blue]
        > Eduardo78 wrote:[color=green]
        > > Hello everybody,
        > >
        > > I heard I could clear (or move spaces) to all controls at ones without
        > > having to call each one of them. If someone remembers how to do that, I will
        > > apreciate your help.
        > >
        > > My scenario is a form where I have multiples groupboxes, and in each of
        > > those groups i have text boxes, where users enter data. And I want to have
        > > an option where the user can clear the controls in particular group at once.
        > > And I do not want to be calling for each one of the controls for that
        > > process.
        > > I used to move spaces to each one of them like this:
        > >
        > > text1.text = ""
        > > text2.text=""
        > > text3.text = ""
        > > ...
        > > textn.text = ""
        > >
        > > but there are a lot of controls in this application.
        > >
        > >
        > > Thanks for any good suggestions.
        > >
        > > Edd[/color]
        >
        > For each Ctr as Control in GroupBox.Contro ls
        > Ctr.Text = ""
        > Next
        >
        > This should work.
        > Chris
        >[/color]

        Comment

        • Chris

          #5
          Re: Clear Multiple controls at the same time

          Eduardo78 wrote:[color=blue]
          > Thanks a lot Chris, it worked good, but it also cleared the labels on that
          > groupbox, how could I make it to clear just the textboxes?
          >
          > "Chris" wrote:
          >
          >[color=green]
          >>Eduardo78 wrote:
          >>[color=darkred]
          >>>Hello everybody,
          >>>
          >>>I heard I could clear (or move spaces) to all controls at ones without
          >>>having to call each one of them. If someone remembers how to do that, I will
          >>>apreciate your help.
          >>>
          >>>My scenario is a form where I have multiples groupboxes, and in each of
          >>>those groups i have text boxes, where users enter data. And I want to have
          >>>an option where the user can clear the controls in particular group at once.
          >>>And I do not want to be calling for each one of the controls for that
          >>>process.
          >>>I used to move spaces to each one of them like this:
          >>>
          >>>text1.text = ""
          >>>text2.text=" "
          >>>text3.text = ""
          >>>...
          >>>textn.text = ""
          >>>
          >>>but there are a lot of controls in this application.
          >>>
          >>>
          >>>Thanks for any good suggestions.
          >>>
          >>>Edd[/color]
          >>
          >>For each Ctr as Control in GroupBox.Contro ls
          >> Ctr.Text = ""
          >>Next
          >>
          >>This should work.
          >>Chris
          >>[/color][/color]

          Blah... Ya, sorry about that...

          For each Ctr as Control in GroupBox.Contro ls
          if Typeof Ctr is TextBox then
          Ctr.Text = ""
          End if
          Next

          Comment

          • Chris

            #6
            Re: Clear Multiple controls at the same time

            Curtis wrote:[color=blue]
            > Eduardo,
            >
            > Try this where "me" is your form:
            >
            > Me.Controls.Cle ar()
            >
            > Curtis
            >
            > "Eduardo78" <Eduardo78@disc ussions.microso ft.com> wrote in message
            > news:BDB1BE20-5876-4E9B-9447-1D4B1882CFB8@mi crosoft.com...
            >[color=green]
            >>Hello everybody,
            >>
            >>I heard I could clear (or move spaces) to all controls at ones without
            >>having to call each one of them. If someone remembers how to do that, I
            >>will
            >>apreciate your help.
            >>
            >>My scenario is a form where I have multiples groupboxes, and in each of
            >>those groups i have text boxes, where users enter data. And I want to
            >>have
            >>an option where the user can clear the controls in particular group at
            >>once.
            >>And I do not want to be calling for each one of the controls for that
            >>process.
            >>I used to move spaces to each one of them like this:
            >>
            >>text1.text = ""
            >>text2.text= ""
            >>text3.text = ""
            >>...
            >>textn.text = ""
            >>
            >>but there are a lot of controls in this application.
            >>
            >>
            >>Thanks for any good suggestions.
            >>
            >>Edd[/color]
            >
            >
            >[/color]

            Um, that would remove all the controls from his form... That's not what
            he is trying to do.

            Chris

            Comment

            • Eduardo78

              #7
              Re: Clear Multiple controls at the same time

              Thanks Curtis, but that command clears evething in the form. I just want to
              clear the textboxes in a specific groupbox in the form.

              Thanks,

              Eduardo

              "Curtis" wrote:
              [color=blue]
              > Eduardo,
              >
              > Try this where "me" is your form:
              >
              > Me.Controls.Cle ar()
              >
              > Curtis
              >
              > "Eduardo78" <Eduardo78@disc ussions.microso ft.com> wrote in message
              > news:BDB1BE20-5876-4E9B-9447-1D4B1882CFB8@mi crosoft.com...[color=green]
              > > Hello everybody,
              > >
              > > I heard I could clear (or move spaces) to all controls at ones without
              > > having to call each one of them. If someone remembers how to do that, I
              > > will
              > > apreciate your help.
              > >
              > > My scenario is a form where I have multiples groupboxes, and in each of
              > > those groups i have text boxes, where users enter data. And I want to
              > > have
              > > an option where the user can clear the controls in particular group at
              > > once.
              > > And I do not want to be calling for each one of the controls for that
              > > process.
              > > I used to move spaces to each one of them like this:
              > >
              > > text1.text = ""
              > > text2.text=""
              > > text3.text = ""
              > > ...
              > > textn.text = ""
              > >
              > > but there are a lot of controls in this application.
              > >
              > >
              > > Thanks for any good suggestions.
              > >
              > > Edd[/color]
              >
              >
              >[/color]

              Comment

              • Eduardo78

                #8
                Re: Clear Multiple controls at the same time

                Thanks Curtis, but that command clears evething in the form. I just want to
                clear the textboxes in a specific groupbox in the form.

                Thanks,

                Eduardo

                "Curtis" wrote:
                [color=blue]
                > Eduardo,[/color]

                "Chris" wrote:
                [color=blue]
                > Curtis wrote:[color=green]
                > > Eduardo,
                > >
                > > Try this where "me" is your form:
                > >
                > > Me.Controls.Cle ar()
                > >
                > > Curtis
                > >
                > > "Eduardo78" <Eduardo78@disc ussions.microso ft.com> wrote in message
                > > news:BDB1BE20-5876-4E9B-9447-1D4B1882CFB8@mi crosoft.com...
                > >[color=darkred]
                > >>Hello everybody,
                > >>
                > >>I heard I could clear (or move spaces) to all controls at ones without
                > >>having to call each one of them. If someone remembers how to do that, I
                > >>will
                > >>apreciate your help.
                > >>
                > >>My scenario is a form where I have multiples groupboxes, and in each of
                > >>those groups i have text boxes, where users enter data. And I want to
                > >>have
                > >>an option where the user can clear the controls in particular group at
                > >>once.
                > >>And I do not want to be calling for each one of the controls for that
                > >>process.
                > >>I used to move spaces to each one of them like this:
                > >>
                > >>text1.text = ""
                > >>text2.text= ""
                > >>text3.text = ""
                > >>...
                > >>textn.text = ""
                > >>
                > >>but there are a lot of controls in this application.
                > >>
                > >>
                > >>Thanks for any good suggestions.
                > >>
                > >>Edd[/color]
                > >
                > >
                > >[/color]
                >
                > Um, that would remove all the controls from his form... That's not what
                > he is trying to do.
                >
                > Chris
                >[/color]

                Comment

                Working...