APPENDIX Exercise Solutions
CHAPTER 1
The code for the following exercise is found in the code file Chapter 1/Exercise1.zip.
- 1. Create a Windows application with a Textbox control and a Button control that displays whatever is typed in the text box when the user clicks the button.
- A. To display the text from a text box on a form when the user clicks the button, you add the following bolded code to the button’s
Clickevent handler:
Private Sub btnDisplay_Click(sender As Object, _ e As EventArgs) Handles btnDisplay.Click 'Display the contents of the text box MessageBox.Show(txtInput.Text, "Exercise 1") End Sub
CHAPTER 2
No exercises for Chapter 2.
CHAPTER 3
-
1. Create a Windows application with two button controls. In the
Clickevent for the first button, declare twoIntegervariables and set their values to any number that you want. Perform any math operation on these variables and display the results in a message box. In theClickevent for the second button, declare twoStringvariables and set their values to anything that you like. Perform a string concatenation on these variables and display the results in a message box. -
A. The first part of this exercise requires you to declare two
Integervariables and set their values, and then to perform a math operation of these variables and display the results in a message box. The variables can be declared and set as:'Declare variables and set their values Dim intX As Integer = 5 Dim intY As Integer = 10
-
To perform ...
-
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access