Results 1 to 5 of 5

Thread: textboxes

  1. #1

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Does any body know how i can clear out all of the contents of my text boxes in my application?

    If text1.text = visible then
    clear text1.text '???????????????

    I really have no idea how to accomplish this task

    Thanks =C)

  2. #2
    Fanatic Member Stevie's Avatar
    Join Date
    Mar 2000
    Location
    London, UK
    Posts
    565
    When I need to do this I make sure all my text boxes have the same tag. eg 'TextBox'

    Then you could do something like :

    dim ctl as control

    for each ctl in me
    if ctl.tag = "TextBox" then ctl.Text = ""
    next ctl

    You have to trap the error which occurs when a control without a tag property is checked. Sorry can't remember it off hand, as all my VB stuff is at work.

    Hope this helps.

  3. #3

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Thanks Steve,
    I see what you mean by setting all of the tags to something to like textbox. This way i guess you can use
    a For Each - Next loop to to repeat a group of statements for each element in a collection of objects. Did i say that Right??? {{{laughing}}} but i still have to figure out the group part in the , For Each (element) In Group. Group would be the????????

    Thanks again.

  4. #4

    Thread Starter
    Dazed Member
    Join Date
    Oct 1999
    Location
    Ridgefield Park, NJ
    Posts
    3,418
    Thanks Steve,
    I see what you mean by setting all of the tags to something to like textbox. This way i guess you can use
    a For Each - Next loop to to repeat a group of statements for each element in a collection of objects. Did i say that Right??? {{{laughing}}} but i still have to figure out the group part in the , For Each (element) In Group. Group would be the????????

    Thanks again.

  5. #5
    Lively Member
    Join Date
    Jun 1999
    Location
    East Anglia, England
    Posts
    73

    Try This

    Hello,
    Here you go a little piece of code which should help you,
    Code:
        Dim obj As Object
        
        For Each obj In Me.Controls
            If TypeOf obj Is TextBox Then
                obj.Text = ""
            End If
        Next
    Hope it helps,
    Desire.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width