|
-
May 3rd, 2002, 11:06 PM
#1
text boxes
hi there,
I have a form with few controls in which some are textboxes and one command button here now i want that on the command click event the programmme should search each control and check it if it is a text box and if it is a text box then the contents of all the textboxes should be cleared.
I need the codes for this.
thankx...
Pranay...
pandit
Let me sign the excellece...
Whenever I hear "It can't be done", I know, I am close to success!! 
-
May 3rd, 2002, 11:15 PM
#2
Re: text boxes
for each ctrl in me.controls
if typeofcontrol is textbox then
textbox.text=""
end if
next
-
May 3rd, 2002, 11:25 PM
#3
Re: text boxes
this is giving an error as object required.
pandit
Let me sign the excellece...
Whenever I hear "It can't be done", I know, I am close to success!! 
-
May 3rd, 2002, 11:32 PM
#4
Re: text boxes
Use the following code:
for i = 0 to me.Controls.Count - 1
If TypeOf me.Controls(i) is TextBox then
me.Controls(i).Text = ""
End If
next
-
May 3rd, 2002, 11:48 PM
#5
Re: text boxes
thankx vivek it worked for me!
also thanks to s_bist.
Bist your code may also be correct but i didnt get it so it is a problem with me not with your code i think.
cheers )
pandit
Let me sign the excellece...
Whenever I hear "It can't be done", I know, I am close to success!! 
-
May 4th, 2002, 12:15 PM
#6
Re: text boxes
Slight revision to s_Bist
private Sub Command1_Click()
Dim ctrl as Control
for Each ctrl In me.Controls
If TypeOf ctrl is TextBox then
ctrl.Text = ""
End If
next
End Sub
'
'
Please rate it if it answers the question
or is useful.
'
John G
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|