Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

clear textbox in frame1 2

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
422
IT
experiment...

i need to clear all tetxtbox in frame1, but dont work

note:
in frame1 i have only tetxtbox and label

Code:
Private Sub PULISCI_TBOX()

Dim CTL As Control
    For Each CTL In Me.Controls
        If Not CTL.Container Is Nothing Then
            If CTL.Container.Name = "Frame1" Then
             'Debug.Print CTL.Name
                If TypeName(CTL) = "Textbox" Then
                    [b]'here i need to set the currebnt tetxtbox=""[/b] 
                    'Debug.Print CTL.Name
                End If
            End If
        End If
    Next CTL
    
End Sub
 
Instead of:
[tt]If TypeName(CTL) = "Textbox" Then[/tt]
I would use:
[tt]If TypeOf CTL Is TextBox Then[/tt]

Your code would work if you would have:[tt]
If TypeName(CTL) = "Text[highlight #FCE94F]B[/highlight]ox" Then[/tt]
or, for example[tt]
If UCase(TypeName(CTL)) = "TEXTBOX" Then[/tt]

I would also eliminate:[tt]
If Not CTL.Container Is Nothing Then[/tt]
I think all controls have Container...

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
>I think all controls have Container...

Timer control ...
Commondialog control ...

The basic rule is that visible controls have a Container property.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top