Results 1 to 6 of 6

Thread: Clear Text Button

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Texas
    Posts
    26

    Cool

    I am trying to set up a button to that when you click it, it will clear the text in a certain textbox.
    I tryed to motify a previous code but it didn't work:

    Private Sub cleartext_Click()
    If inputtext.SelText = "" Then
    Clear.SetText inputtext
    Else
    Clear.SetText inputtext.SelText
    End If
    End Sub

    But that didnt work, but I took a shot...

    Know whats wrong?

    Thanks,
    System

  2. #2
    Guest
    Try this:

    Code:
    Private Sub cleartext_Click() 
    inputtext.Text= ""
    End Sub

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Location
    Texas
    Posts
    26

    Thumbs up Thanks

    Thanks, works like a charm.

    -System

  4. #4
    Hyperactive Member Asaf_99's Avatar
    Join Date
    Jul 2000
    Location
    Israel
    Posts
    335

    Talking Damn!

    If I would see that message before Matthew, I would post that too.
    Asaf Sagi

    ICQ: 61917199
    E-Mail: [email protected]

  5. #5
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    in a module:
    Code:
    Public Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    the commandbutton code
    Code:
    SetWindowText Me.Text1.hwnd, ""
    replace text1 with anything, including labels !

  6. #6
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    sorry, you can't use it with labels

    because they don't have a HWND variable unless you look for it.

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