# Create a TextBox clear button in VB?



## INTELCRAZY

I want to make a button in one of my programs that will clear all textboxes in the form, how do I do this? It's Visual Basic 2005 Express Edition...



Thanks


----------



## wungoodshu

Make a button, program it to do...

Text1 = ""

Text1 being the name of the text box. Just make the list longer if you want the button to clear multiple text boxes.


----------



## INTELCRAZY

wungoodshu said:


> Make a button, program it to do...
> 
> Text1 = ""
> 
> Text1 being the name of the text box. Just make the list longer if you want the button to clear multiple text boxes.



Okay thanks


----------



## INTELCRAZY

How could I select between different forms? I don't even know how to make a program that uses two different Windows yet...


----------



## K3rupt

You create the Forms,

You know how to do this?

If Not:

Right Click your current Form (Default Top Left, Default Names is Form1)

Go to Add

Click Form

Then, You reference the form it is in in the Code window 

Using

form2.txtbox1.text = ""

*EG:*

You create A Form:
With 2 cmd box's
and a text box

Create another form

One command box with clear the writing on its own form
The other command box will clear the writing on the Otherform

Now, Just do as i have done:
Try out the Code i have done.
I have done it differently too what you may want too do














You may have a cmd box that when clicked, brings up other form

This would be done using Form2.show

Easy


----------



## INTELCRAZY

K3rupt said:


> You create the Forms,
> 
> You know how to do this?
> 
> If Not:
> 
> Right Click your current Form (Default Top Left, Default Names is Form1)
> 
> Go to Add
> 
> Click Form
> 
> Then, You reference the form it is in in the Code window
> 
> Using
> 
> form2.txtbox1.text = ""
> 
> *EG:*
> 
> You create A Form:
> With 2 cmd box's
> and a text box
> 
> Create another form
> 
> One command box with clear the writing on its own form
> The other command box will clear the writing on the Otherform
> 
> Now, Just do as i have done:
> Try out the Code i have done.
> I have done it differently too what you may want too do
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> You may have a cmd box that when clicked, brings up other form
> 
> This would be done using Form2.show
> 
> Easy



Yeah, Thanks, I could do that...

But I want to run like different forms that contain different things, so I want one form to be like a menu and use buttons to link into the other forms. How do I do this?

Thanks again


----------



## K3rupt

INTELCRAZY said:


> Yeah, Thanks, I could do that...
> 
> But I want to run like different forms that contain different things, so I want one form to be like a menu and use buttons to link into the other forms. How do I do this?
> 
> Thanks again



Do you know about all the ways too put the words in (hard to desribe)

Eg: you must call Command Buttons cmd(then the name here without brackets)

text box must be txt(name)

Labels must be lbl(name)



Just create the forms with what you want on them

Too refrence and item in another form to change its propertys, You must write the forms name, Then the item you wish to change its property, then the items itselfs property, then what you want too change it too.

Eg

form2.txtexample.text = "I am Not a Nub"


Or if you wanted like Radio Buttons on a different form changing something on the main form

Create how ever many radio (option) buttons you want on the form
Create the other items (for my example im using a text box)

*Prime example*

Main Form's name = Form1  (Containing the text box)
Other form's name = Form2 (containing 3 Radio Buttons, Not in an array)
textbox's name = txtchanged
Option button 1 name = Option1
option button 2 name = Option2
Option button 3 name = Option3

Ok.

What this program will do is When a radio button is clicked, it will change the propertys of another item on the other form.

Here you go:


----------



## INTELCRAZY

K3rupt said:


> Do you know about all the ways too put the words in (hard to desribe)
> 
> Eg: you must call Command Buttons cmd(then the name here without brackets)
> 
> text box must be txt(name)
> 
> Labels must be lbl(name)
> 
> 
> 
> Just create the forms with what you want on them
> 
> Too refrence and item in another form to change its propertys, You must write the forms name, Then the item you wish to change its property, then the items itselfs property, then what you want too change it too.
> 
> Eg
> 
> form2.txtexample.text = "I am Not a Nub"
> 
> 
> Or if you wanted like Radio Buttons on a different form changing something on the main form
> 
> Create how ever many radio (option) buttons you want on the form
> Create the other items (for my example im using a text box)
> 
> *Prime example*
> 
> Main Form's name = Form1  (Containing the text box)
> Other form's name = Form2 (containing 3 Radio Buttons, Not in an array)
> textbox's name = txtchanged
> Option button 1 name = Option1
> option button 2 name = Option2
> Option button 3 name = Option3
> 
> Ok.
> 
> What this program will do is When a radio button is clicked, it will change the propertys of another item on the other form.
> 
> Here you go:




I just need a button to open another form, what do I code to do this?


Thanks


----------



## K3rupt

INTELCRAZY said:


> I just need a button to open another form, what do I code to do this?
> 
> 
> Thanks



the forms name . show

so 

form2.show


----------



## INTELCRAZY

K3rupt said:


> the forms name . show
> 
> so
> 
> form2.show



Nice Thanks...

Watch out I am working on a project... I might trouble you for more stuff


----------



## K3rupt

INTELCRAZY said:


> Nice Thanks...
> 
> Watch out I am working on a project... I might trouble you for more stuff



Sure 

Ill keep checking this Thread for a few days 

Feel Free to ask what you want


----------

