Clearing text from text box 
Author Message
 Clearing text from text box

Hello,

Please help. I am just learning VB6 and would like to
know how do you "Clear text" from the text box using the
command buttons? I use this, but it didn't clear it.
txtName.Text = ""
txtAddress.Text = ""
txtCity.Text = ""
txtState.Text = ""
txtZip.Text = ""

How do you Save text in both a database & in a text file?
Also do you to "Save" it on the hard drive. Thanks!



Fri, 09 Sep 2005 06:13:42 GMT  
 Clearing text from text box
thats the way we clear the text in textboxes, anyways open a new vb project
of type standard exe and drop one command button and one text box on for
form.

copy and paste the following code in the form code window:

Private Sub Command1_Click()
    Text1.Text = ""
End Sub

Private Sub Form_Load()
    Text1.Text = "some text"
End Sub

run and click the command button, may be you have put those lines(mentioned
by you earlier) at wrong place?

There are lottssa ways to save the text in DB/text files etc.

try to read some ADO/File handling tutorials for that

cheers
Ashok Gupta


Quote:
> Hello,

> Please help. I am just learning VB6 and would like to
> know how do you "Clear text" from the text box using the
> command buttons? I use this, but it didn't clear it.
> txtName.Text = ""
> txtAddress.Text = ""
> txtCity.Text = ""
> txtState.Text = ""
> txtZip.Text = ""

> How do you Save text in both a database & in a text file?
> Also do you to "Save" it on the hard drive. Thanks!



Fri, 09 Sep 2005 12:25:33 GMT  
 Clearing text from text box

Quote:
>-----Original Message-----
>Hello,

>Please help. I am just learning VB6 and would like to
>know how do you "Clear text" from the text box using the
>command buttons? I use this, but it didn't clear it.
>txtName.Text = ""
>txtAddress.Text = ""
>txtCity.Text = ""
>txtState.Text = ""
>txtZip.Text = ""

Here is code that will save you time if you have a lot of
text boxs. Call this sub from your command button.

Private Sub ClearTextBoxs()
'clear all cbo boxs
    Dim ctl As Control
    For Each ctl In Me.Controls
        If TypeOf ctl Is TextBox Then
            ctl.Text = ""
        End If
    Next ctl
End Sub

hth
PhilipL



Sun, 11 Sep 2005 00:59:45 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Text box text on new page text box

2. Converting text in text boxes to inline text

3. Clearing text from a text file

4. Rich Text Box: Can I remove text and keep multicolored text

5. how to get scrolling text in a text box or like Marquee text

6. Modifying Text Format in use without changing text in entire text box

7. Clearing a text box after submitting a from

8. Clearing DBCombo Text Box

9. Clear all text boxes

10. How to clear a text box?

11. clearing text boxes after adding records

12. Clear the text boxes

 

 
Powered by phpBB® Forum Software