An application contains the Structure statement shown here.
Structure MyFriend
Public strName As String
Public strBirthday As String
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.
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
The solution that I see is:
Public Class frmMain
Structure MyFriend
Public strName As String
Public strBirthday As String
End Structure
Private Sub btnExecute_Click(sender As Object, e As EventArgs)
Handles btnExecute.Click
Dim friendArray As MyFriend
friendArray.strName = txtName.Text
friendArray.strBirthday = txtBirthday.Text
MessageBox.Show("Entered Name is " + friendArray.strName +
vbNewLine + "Entered Birthday is " + friendArray.strBirthday)
End Sub
End Class
However, I do not see "In the button click event, write a Dim statement that declares a five-element one-dimensional array of MyFriend variables. Name the array home." Am I missing it or not understanding something?
Updated Code:
Public Class frmMain
'Added structure to frmMain class
Structure MyFriend
Public strName As
String
Public strBirthday As
String
End Structure
' Execute button click event handler
Private Sub btnExecute_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
btnExecute.Click
' Declaring a
five-element one-dimensional array of MyFriend variables.
' Array name: home
Dim home(5) As
MyFriend
' Storing
user entered values to last element of array
home(4).strName =
txtName.Text
home(4).strBirthday =
txtBirthday.Text
' Displaying
stored values in message box
MessageBox.Show("Entered
Name is " + home(4).strName + vbNewLine + "Entered Birthday is " +
home(4).strBirthday)
End Sub
End Class
______________________________________________________________________________________________
Sample Run:

An application contains the Structure statement shown here. Structure MyFriend Public strName As String Public strBirthday...
Here is the code for the Infant class: public class Infant{ private String name; private int age; // in months public Infant(String who, int months){ name = who; age = months; } public String getName(){ return name;} public int getAge(){ return age;} public void anotherMonth() {age = age + 1;} } The code box below includes a live Infant array variable, thoseKids. You cannot see its declaration or initialization. Your job is to find out which Infant in the array...
Project 2 – Memory Match Game Purpose This Windows Classic Desktop application plays a simple matching game. The game simulates a card game where the cards a placed face down and the player flips over pairs of cards in an attempt to find matching cards. Program Procedure Display a 4x4 grid of “face down” cards. Assign the letters A through H randomly to the cards in pairs. Allow the user to click on a card to “flip” it over and...
Visual Basic 2015: Extra 18-1 Use inheritance with the Inventory
Maintenance Application
Source Code:
1. frmNewItem.vb
Public Class frmNewItem
Public InvItem As InvItem
Private Sub frmNewItem_Load(sender As Object, e As EventArgs)
Handles MyBase.Load
Me.LoadComboBox()
End Sub
Private Sub LoadComboBox()
cboSizeOrManufacturer.Items.Clear()
If rdoPlant.Checked Then
cboSizeOrManufacturer.Items.Add("1 gallon")
cboSizeOrManufacturer.Items.Add("5 gallon")
cboSizeOrManufacturer.Items.Add("15 gallon")
cboSizeOrManufacturer.Items.Add("24-inch box")
cboSizeOrManufacturer.Items.Add("36-inch box")
Else
cboSizeOrManufacturer.Items.Add("Bayer")
cboSizeOrManufacturer.Items.Add("Jobe's")
cboSizeOrManufacturer.Items.Add("Ortho")
cboSizeOrManufacturer.Items.Add("Roundup")
cboSizeOrManufacturer.Items.Add("Scotts")
End If
End Sub
Private Sub btnSave_Click(sender As Object, e As EventArgs)
Handles btnSave.Click
If IsValidData() Then
InvItem = New InvItem(CInt(txtItemNo.Text),...
Zander Inc. stores employee IDs and salaries in a sequential
access file named Employees.txt. Open the VB2015\Chap10\Zander
Solution\Zander Solution (Zander Solution.sln) file. Open the
Employees.txt file, which is contained in the project’s bin\Debug
folder. The ID and salary information appear on separate lines in
the file. Close the Employees.txt window. a. Define a structure
named Employee. The structure should contain two member
variables:
a String variable to store the ID and a Double variable to store
the salary.
b. Declare...
In this exercise, you’ll add code to a form that converts the
value the user enters based on the selected conversion type.
The application should handle the following conversions:
1. Open the Conversions project. Display the code for the form,
and notice the rectangular array whose rows contain the value to be
displayed in the combo box, the text for the labels that identify
the two text boxes, and the multiplier for the conversion as shown
above. Note: An array...
I need to write a loop that examines the names of the cities stored in the array. Write code that tests for a match Write code that, when appropriate, prints the message: Not a city in Illinois _______________________________________________________________ ' IllinoisCities.vb - This program prints a message for invalid cities in Illinois. ' Input: Interactive ' Output: Error message or nothing Option Explicit On Option Strict On Module IllinoisCities Sub Main() ' Declare variables. Dim city As String ...
Visual Basic: Create an application that simulates a tic tac toe game. The form uses 9 large labels to display the x's and o's. The application should use a two dimensional integer array to simulate the game board in memory. When the user clicks the "New Game" button the application should step throguh the array storing a random number of 0 to 1 in each element. The numer 0 represent the letter o and the number 1 reprsents the letter...
1)
Which statement is TRUE about the subroutine MyProcedure and the statement calling MyProcedure? Call statement: MyProcedure(100.0, 1000.0, 209.53) Subroutine: Sub MyProcedure(ByVal var1 As String, ByVal var2 As Double. ByVal var3 As Double) End Sub O 10000 is a constant and cannot be used as an argument value Only variables can be used as arguments in a subroutine call statement O In the call statement, a String value is provided where a Double is expected O In the call statement,...
Question 2: Execute the following program. import java.util.Arrays; public class ArrayManipulations { public static void main(String[] args) { // sort doubleArray into ascending order char [] A = {'g', ', 'y', 'a', 'e','d' }; Arrays.sort( A); for (char value: A) System.out.printf("%2C", value); System.out.printf("\n"); char [] A Copy = new char[ 3 ]; System.arraycopy( A, 2, A Copy, 0, A Copy.length); for(char value: A Copy) System.out.printf("%2C", value); System.out.printf("\n"); int location = Arrays.binary Search(A Copy, 'y'); if(location >=0) System.out.printf("y Found at element...
This must be done in Java and it must contain a public static void (string []args) 10.13 (Project: Shape Hierarchy) Implement the Shape hierarchy shown in Fig. 9.3. Each TwoDimensionalShape should contain method getArea to calculate the area of the two-dimensional shape. Each ThreeDimensionalShape should have methods getArea and getVolume to calculate the surface area and volume, respectively, of the three-dimensional shape. Create a program that uses an array of Shape references to objects of each concrete class in the hierarchy. The program...