Create a simple user interface
This article will teach you how to create a Button, Label and a Textbox control. Note this has nothing to do with Ecopath.
- On the File menu, choose New Project.
- In the New Project dialog box, in the Templates pane, click Windows Application.
- In the Name box, type TextBoxExample, and then click OK.
A new Windows Forms project opens.
- From the Toolbox, drag a TextBox, Label, and Button control onto the form.
- Select the Label control and drag it above the TextBox control
- In the Properties window, change the Text property of the Label control to the following code.
Enter your name and click the button.
Now that you have created a basic user interface, you will need to add a little bit of code to your program, and then it will be ready to test!
To add code and test your program
- Double-click the Button control to open the Code Editor.
The Code Editor opens the Button1_Click event handler.
- Add the following line of code to the Button1_Click event handler.
MsgBox("Your Name is " & Textbox1.Text)
- Press F5 to run your program.
- When the form appears, type your name in the TextBox control and click the button. A message box appears, displaying the text in the TextBox control. Change the text and click the button again. Each time you click the button, the updated text is displayed.