Databases Reference
In-Depth Information
6. Drag a Button control onto the form and place it below the Label and TextBox
controls. Select the Button control, go to the Properties window, change the Name
property to btnSubmit, and then set its Text property to Submit.
Now you have your GUI design of the application ready; it should resemble the
form shown in Figure 14-8.
Figure 14-8. GUI design of the Windows Application form
It's time to add functionality and switch the Code view. You are going to read in
the First Name and Last Name values supplied by the user and flash a message
on a click of the Submit button, which means you need to put all the functional-
ity behind the Submit button's click event, which will eventually read the values
from the TextBoxes. To achieve this, continue with these steps:
7. Double-click the Submit button. This will take you to Code view, and you will see
that the btnSubmit_Click event template has been added to the code editor win-
dow, as shown in Figure 14-9.
8. Now add the following code inside this btnSubmit_Click event to achieve the
desired functionality:
MessageBox.Show("Hello" + ' ' + txtFname.Text + ' ' + txtLname.Text + ' ' +
"Welcome to the Windows Application");
9. Once you have added the code, click Build รค Build Solution, and ensure that you
see the following message in the Output window:
========== Build: 1 succeeded or up-to-date, 0 failed, 0 skipped ==========
Search WWH ::




Custom Search