Database Reference
In-Depth Information
Figure 9-8. GUI design of the Windows Application form
It's time to add functionality and switch to 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 functionality behind the Submit button's click event, which will eventually
read the values from the TextBox controls. To achieve this, continue with these steps:
8. Double-click the Submit button. This will take you to the Code view, and you
will see that the btnSubmitClick event template has been added to the Code
view window. Now you will add the code to show a dialog box, with a greeting
and welcome message for the entered first name and last name. To do so, you
will use MessageBox class; this class provides a Show() function to display a
dialog box with the provided information. Now let's add the following code
inside this btnSubmitClick event to achieve the desired functionality of a
dialog, with a message, a caption in dialog box's title bar, an OK button, a
Cancel button, and an information icon displayed:
MessageBox.Show("Hello" + ' ' + txtFname.Text + ' ' + txtLname.Text + ' ' +
"Welcome to the Windows Application","Welcome", MessageBoxButtons.OKCancel,
MessageBoxIcon.Information);
Now your Code view will show the button's click event code, as shown in Figure 9-9.
 
Search WWH ::




Custom Search