I'm really a beginner so I need an answer for this stupid question:
How to make a text box and do that everything you'll write in it will immediately appear on the form.
Printable View
I'm really a beginner so I need an answer for this stupid question:
How to make a text box and do that everything you'll write in it will immediately appear on the form.
Say the name of the text box is " txtMyBox " then all u do is:
Private sub txtMyBox_Change()
[ whatever you want to say it in] = txtMyBox.text
End Sub
i ment that the text box itself would be empty but when you run the app, when you'll write something it will also apear on the form.
I don't get it, is this what u mean :
1. you want it to copy the text you put in the textbox on to another object ?
2. You want it to put text into the text box when the form is loaded or on another event?
3. Other.
If you want that what you put in a text box will be on the
form you should use this code:
Private Sub Text1_Change()
Me.Cls
Print Text1.Text
End Sub
Try it.
No,
What i mean is, to do a simple program that only has a text box control, when you write something in the text box it will also apear on the form.
let's say i want to do the same thing only the text will apear as the form's caption, i will do something like this:
text1.text = form1.caption
i want to do the same thing only the text will apear on the form...
You mean, appear on the form's title. :rolleyes:
Exactly the opposite of the other code:
Code:Form1.Caption = Text1.Text
Thanks everyone but the example of Dekelc already work.
no can someone explain it please, what do this mean:
Private Sub Text1_Change()
Me.Cls
Print Text1.Text
End Sub
Here, it's commented. :rolleyes:
Code:Private Sub Text1_Change() ' Code below will execute when you type something in the TextBox
Cls ' Remove whatever it says on the form
Print Text1.Text ' Print on the form whatever it says on the TextBox
End Sub
Thanks For everyone that Helped,
but i have another small question (i'm sorry):
If I take out the "cls", it jumps to a new line every
time I write another letter.
why?
It will do - the Print command goes to a new line and writes whatever.
You are new at VB aren't you.....?!
I already said i'm new to VB (my first week),
but you didn't answer my question:
cls just supose to clear the form,isn't it,
so why if I delete it, every time i write a letter
it jumps to a new line and write it.
Cls clears the form and also resets the drawing origin (where it starts from) to the top left. Every time you call Print, it moves this origin down to below the last printed text.
Private Sub Text1_Change()
Me.Cls
Print Text1.Text
End Sub
doesn't jump for me...
OK, i'm done, thanks!
If you do not like where it prints, you can set it by changing the CurrentX and CurrentY properties.Quote:
Originally posted by macron
Thanks For everyone that Helped,
but i have another small question (i'm sorry):
If I take out the "cls", it jumps to a new line every
time I write another letter.
why?