basic-programing
Work 1
For this coding exercise, write the Visual Basic code for a pretest loop that uses an Integer variable named intEven to display the even integers from 2 through 20 in the lblEven control.
- Use the For…Next statement.
- Display each number on a separate line in the control.
- Then create an application to test your code using the following names for the solution and project, respectively: Even Solution and Even Project.
- Save the application in the VB2015 Chap06 folder.
- Add a button and a label to the interface. Enter your code in the button’s Click event procedure, and then test the application appropriately.
Assignment Deliverables;
- The zip file containing the Visual Studio solution and project files.
Work 2
An application contains the Structure statement shown here.
Structure MyFriend _x000D_ Public strName As String _x000D_ Public strBirthday As String_x000D_ End Structure
- Create a VB.Net Windows Form application named MyFriend_YourName. Change the name property of your form to frmMain.
- Add the MyFriend Structure to the public class frmMain.
- Create 2 text boxes txtName and txtBirthday, and a button with the name property changed to btnExecute and the text property changed to Execute.
- In the button click event, write a Dim statement that declares a five-element one-dimensional array of MyFriend variables. Name the array home.
- Then write an assignment statement that assigns the value in the txtName control to the strName member contained in the last array element.
- Write an assignment statement that assigns the value in the txtBirthday control to the strBirthday member contained in the last array element.
- Output the values from the last array element to a message box in the format “Your name is Name and your birthday is Birthday.†Name and Birthday are replaced with actual values from your array.
- Set a breakpoint next to you’re the Dim statement of your home array. See page 829 in your text for how to set breakpoints in VB.Net or search online.
- Run your form, add a name and date to the respective text boxes and click the Execute button. Execution should stop at the breakpoint. Use the Debug menu or shortcut keys to step through the code. All code should execute without error.
Assignment Deliverables:
- The zip file containing the Visual Studio solution and project files.