|
Now you ll write some code that takes the text that the user enters into the text box and displays it as the text of the label. This program isn t very sophisticated, but you ll learn a surprising amount about Web programming from just this simple example.
In Design view, double-click the button on your page. Web Matrix switches to Code view, and you ll see the following code:
Sub Button1_Click(sender As Object, e As Event Args End Sub
This code is the basic outline the skeleton of the button Click event handler. (We ll discuss event handlers in the next section.)
Add the following boldfaced line to the code:
Sub Button1_Click(sender As Object, e As Event Args Label1.Text = TextBox1.Text End Sub
This line of code will take the contents of the TextBox control whose name is (imaginatively enough) TextBox1 and display it as the contents of the Label control called Label1. (I did say this first program wasn t too sophisticated, didn t I?)
|