Real Easy one.....

IanW-FRCGroup
01-19-2004, 04:41 AM
Hi,
I've just took up teaching myself Visual Baic.Net. Ive started with a book called "Teach yourself VB.Net in 24 hours"

Ive come to an exercise which im sure is simple but with no programming background at all its a little puzzeling.

This is what i want to do

I have a form, a text box at the top (textbox1), a button in the middle and a text box at the bottom (textbox2).

I want to write code that when I click the button, the text from textbox1 is inserted into textbox2..

Can anyone give me an idea of the code i want to be writing for the button.

Regards

Ian

d3xt3r
01-19-2004, 07:20 AM
hi
the code you could use to do that is in the command button is


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


and the text you write in the textbox 1 will be written in the textbox 2 when you click in the button

D3xt3r

IanW-FRCGroup
01-19-2004, 07:40 AM
:) Thanks for the help. This is the only bit of programming i've done so expect many more post from me lol.

Again though, thanks for the help

Ian

VBJoe
01-19-2004, 10:15 PM
Private Sub Command1_Click()
Text2.Text = Text1.Text
End Sub
Actually, that's VB6 event procedure syntax. Here's the correct syntax for VB.NET:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = TextBox1.Text
End Sub

IanW-FRCGroup
01-20-2004, 05:54 AM
Private Sub Command1_Click()
Text2.Text = Text1.Text
End Sub
Actually, that's VB6 event procedure syntax. Here's the correct syntax for VB.NET:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
TextBox2.Text = TextBox1.Text
End Sub


I ended up using

TextBox2.Text = TextBox1.Text

As soon as i knew the code was that simple i worked it out.

thanks for your help.

Ian

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum