Question

Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the valu...

Project 10-1 Convert lengths In this assignment, 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:

From To Conversion

Miles - Kilometers: 1 mile = 1.6093 kilometers

Kilometers - Miles: 1 kilometer = 0.6214 miles

Feet - Meters: 1 foot = 0.3048 meters

Meters - Feet: 1 meter = 3.2808 feet

Inches - Centimeters: 1 inch = 2.54 centimeters

Centimeters - Inches: 1 centimeter = 0.3937 inches

Feet - Yards: 1 foot = 0.333333 yards

Yards - Feet: 1 yard = 3 feet

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.

2. Set the DropDownStyle property of the combo box so the user must select an item from the list.

3. Add the 2 additional conversion units for feet and yards to the array.

4. Add code to load the combo box (use the load event) with the first element in each row of the rectangular array a. display the first item in the combo box when the form is loaded. (I need to figure out how to grab from the array and not from a list)

5. Add code to: a. change the labels for the text boxes (When the user selects a conversion, the label for the textboxes should reflect that selection.) b. clear the calculated length c. move the focus to the entry text box when the user selects a different item from the combo box.

6. Rename the form to frmConversions.

7. Test the application to be sure the conversions are displayed in the combo box, the first conversion is selected by default, and the labels change appropriately when a different conversion is selected.

8. Add code to calculate and display the converted length when the user clicks the Calculate button. To calculate the length, you can get the index for the selected conversion and then use that index to get the multiplier from the array. Test the application to be sure this works correctly.

9. Add code to check that the user enters a valid decimal value for the length. Then, test the application one more time to be sure the validation works correctly.

Code Given:

Public Class frmConversions

Dim conversionTable(,) As String = {
{"Miles to kilometers", "Miles", "Kilometers", "1.6093"},
{"Kilometers to miles", "Kilometers", "Miles", "0.6214"},
{"Feet to meters", "Feet", "Meters", "0.3048"},
{"Meters to feet", "Meters", "Feet", "3.2808"},
{"Inches to centimeters", "Inches", "Centimeters", "2.54"},
{"Centimeters to inches", "Centimeters", "Inches", "0.3937"},
{"Feet to Yards", "Feet", "Yards", " 0.333333"},
{"Yards to Feet", "Yards", "Feet", "3"}}

Public Function IsPresent(ByVal textbox As TextBox, ByVal name As String) _
As Boolean
If textbox.Text = "" Then
MessageBox.Show(name & " is a required field.", "Entry Error")
textbox.Select()
Return False
Else
Return True
End If
End Function

Public Function IsDecimal(ByVal textbox As TextBox, ByVal name As String) _
As Boolean
Dim number As Decimal = 0
If Decimal.TryParse(textbox.Text, number) Then
Return True
Else
MessageBox.Show(name & " must be a decimal value.", "Entry Error")
textbox.Select()
textbox.SelectAll()
Return False
End If
End Function

Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click

End Sub

Private Sub cboConversions_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cboConversions.SelectedIndexChanged

End Sub

Private Sub btnExit_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles btnExit.Click
Me.Close()
End Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load

End Sub

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Form1.Designer.cs

namespace Conversions
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblCalculatedLength = new System.Windows.Forms.Label();
this.txtLength = new System.Windows.Forms.TextBox();
this.lblToLength = new System.Windows.Forms.Label();
this.lblFromLength = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.btnCalculate = new System.Windows.Forms.Button();
this.cboConversions = new System.Windows.Forms.ComboBox();
this.Label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblCalculatedLength
//
this.lblCalculatedLength.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblCalculatedLength.Location = new System.Drawing.Point(94, 76);
this.lblCalculatedLength.Name = "lblCalculatedLength";
this.lblCalculatedLength.Size = new System.Drawing.Size(96, 20);
this.lblCalculatedLength.TabIndex = 30;
this.lblCalculatedLength.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtLength
//
this.txtLength.Location = new System.Drawing.Point(94, 44);
this.txtLength.Name = "txtLength";
this.txtLength.Size = new System.Drawing.Size(96, 20);
this.txtLength.TabIndex = 25;
//
// lblToLength
//
this.lblToLength.Location = new System.Drawing.Point(14, 76);
this.lblToLength.Name = "lblToLength";
this.lblToLength.Size = new System.Drawing.Size(72, 23);
this.lblToLength.TabIndex = 29;
this.lblToLength.Text = "Kilometers:";
this.lblToLength.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblFromLength
//
this.lblFromLength.Location = new System.Drawing.Point(14, 44);
this.lblFromLength.Name = "lblFromLength";
this.lblFromLength.Size = new System.Drawing.Size(72, 23);
this.lblFromLength.TabIndex = 28;
this.lblFromLength.Text = "Miles:";
this.lblFromLength.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnExit
//
this.btnExit.CausesValidation = false;
this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnExit.Location = new System.Drawing.Point(158, 116);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(80, 23);
this.btnExit.TabIndex = 27;
this.btnExit.Text = "E&xit";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnCalculate
//
this.btnCalculate.Location = new System.Drawing.Point(30, 116);
this.btnCalculate.Name = "btnCalculate";
this.btnCalculate.Size = new System.Drawing.Size(80, 23);
this.btnCalculate.TabIndex = 26;
this.btnCalculate.Text = "&Calculate";
this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);
//
// cboConversions
//
this.cboConversions.DropDownWidth = 160;
this.cboConversions.Location = new System.Drawing.Point(94, 12);
this.cboConversions.Name = "cboConversions";
this.cboConversions.Size = new System.Drawing.Size(144, 21);
this.cboConversions.TabIndex = 24;
this.cboConversions.SelectedIndexChanged += new System.EventHandler(this.cboConversions_SelectedIndexChanged);
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(14, 12);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(72, 23);
this.Label1.TabIndex = 23;
this.Label1.Text = "Conversion:";
this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// Form1
//
this.AcceptButton = this.btnCalculate;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(261, 155);
this.Controls.Add(this.lblCalculatedLength);
this.Controls.Add(this.txtLength);
this.Controls.Add(this.lblToLength);
this.Controls.Add(this.lblFromLength);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnCalculate);
this.Controls.Add(this.cboConversions);
this.Controls.Add(this.Label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Conversions";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

internal System.Windows.Forms.Label lblCalculatedLength;
internal System.Windows.Forms.TextBox txtLength;
internal System.Windows.Forms.Label lblToLength;
internal System.Windows.Forms.Label lblFromLength;
internal System.Windows.Forms.Button btnExit;
internal System.Windows.Forms.Button btnCalculate;
internal System.Windows.Forms.ComboBox cboConversions;
internal System.Windows.Forms.Label Label1;
}
}

Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Conversions
{
public partial class Form1 : Form
{
//declare a rectangular array to store items
private static string[,] comboItems = new string[6, 2];
public Form1()
{
InitializeComponent();
}

private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}

private void Form1_Load(object sender, EventArgs e)
{
//add items to the array
comboItems[0, 0] = "Miles to Kilometers";
comboItems[0, 1] = "1.6093";
comboItems[1, 0] = "Kilometers to miles";
comboItems[1, 1] = "0.6214";
comboItems[2, 0] = "Feet to meters";
comboItems[2, 1] = "0.3048";
comboItems[3, 0] = "Meters to feet";
comboItems[3, 1] = "3.2808";
comboItems[4, 0] = "Inches to Centimeters";
comboItems[4, 1] = "2.54";
comboItems[5, 0] = "Centimeters to inches";
comboItems[0, 1] = "0.3937";
//add the items to the combo box
for (int i = 0; i < comboItems.GetLength(0); i++)
{
cboConversions.Items.Add(comboItems[i, 0]);
}
//select the first item on form load
cboConversions.SelectedIndex = 0;
}

private void cboConversions_SelectedIndexChanged(object sender, EventArgs e)
{
//change the text of labels and clear the textboxes based on items selected in the combo box
if (cboConversions.SelectedIndex == 0)
{
lblFromLength.Text = "Miles: ";
lblToLength.Text = "Kilometers: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 1)
{
lblFromLength.Text = "Kilometers: ";
lblToLength.Text = "Miles: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 2)
{
lblFromLength.Text = "Feet: ";
lblToLength.Text = "Meters: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 3)
{
lblFromLength.Text = "Meters: ";
lblToLength.Text = "Feet: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 4)
{
lblFromLength.Text = "Inches: ";
lblToLength.Text = "Centimeters: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 5)
{
lblFromLength.Text = "Centimeters: ";
lblToLength.Text = "Inches: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}

}

private void btnCalculate_Click(object sender, EventArgs e)
{
double lengthToBeConverted;
double convertedLength;
//check if iniput is valid
if (Double.TryParse(txtLength.Text, out lengthToBeConverted))
{
//convert the length and display it
convertedLength = lengthToBeConverted * Convert.ToDouble(comboItems[cboConversions.SelectedIndex, 1]);
lblCalculatedLength.Text = convertedLength.ToString("0.00");
}
//display error message when invalid input is entered
else
{
MessageBox.Show("Invalid input.", "Error");
txtLength.Focus();
}
}
}
}

Output Screens:-

Form1.Designer.cs

namespace Conversions
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.lblCalculatedLength = new System.Windows.Forms.Label();
this.txtLength = new System.Windows.Forms.TextBox();
this.lblToLength = new System.Windows.Forms.Label();
this.lblFromLength = new System.Windows.Forms.Label();
this.btnExit = new System.Windows.Forms.Button();
this.btnCalculate = new System.Windows.Forms.Button();
this.cboConversions = new System.Windows.Forms.ComboBox();
this.Label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// lblCalculatedLength
//
this.lblCalculatedLength.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.lblCalculatedLength.Location = new System.Drawing.Point(94, 76);
this.lblCalculatedLength.Name = "lblCalculatedLength";
this.lblCalculatedLength.Size = new System.Drawing.Size(96, 20);
this.lblCalculatedLength.TabIndex = 30;
this.lblCalculatedLength.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
//
// txtLength
//
this.txtLength.Location = new System.Drawing.Point(94, 44);
this.txtLength.Name = "txtLength";
this.txtLength.Size = new System.Drawing.Size(96, 20);
this.txtLength.TabIndex = 25;
//
// lblToLength
//
this.lblToLength.Location = new System.Drawing.Point(14, 76);
this.lblToLength.Name = "lblToLength";
this.lblToLength.Size = new System.Drawing.Size(72, 23);
this.lblToLength.TabIndex = 29;
this.lblToLength.Text = "Kilometers:";
this.lblToLength.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// lblFromLength
//
this.lblFromLength.Location = new System.Drawing.Point(14, 44);
this.lblFromLength.Name = "lblFromLength";
this.lblFromLength.Size = new System.Drawing.Size(72, 23);
this.lblFromLength.TabIndex = 28;
this.lblFromLength.Text = "Miles:";
this.lblFromLength.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// btnExit
//
this.btnExit.CausesValidation = false;
this.btnExit.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnExit.Location = new System.Drawing.Point(158, 116);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(80, 23);
this.btnExit.TabIndex = 27;
this.btnExit.Text = "E&xit";
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnCalculate
//
this.btnCalculate.Location = new System.Drawing.Point(30, 116);
this.btnCalculate.Name = "btnCalculate";
this.btnCalculate.Size = new System.Drawing.Size(80, 23);
this.btnCalculate.TabIndex = 26;
this.btnCalculate.Text = "&Calculate";
this.btnCalculate.Click += new System.EventHandler(this.btnCalculate_Click);
//
// cboConversions
//
this.cboConversions.DropDownWidth = 160;
this.cboConversions.Location = new System.Drawing.Point(94, 12);
this.cboConversions.Name = "cboConversions";
this.cboConversions.Size = new System.Drawing.Size(144, 21);
this.cboConversions.TabIndex = 24;
this.cboConversions.SelectedIndexChanged += new System.EventHandler(this.cboConversions_SelectedIndexChanged);
//
// Label1
//
this.Label1.Location = new System.Drawing.Point(14, 12);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(72, 23);
this.Label1.TabIndex = 23;
this.Label1.Text = "Conversion:";
this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// Form1
//
this.AcceptButton = this.btnCalculate;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnExit;
this.ClientSize = new System.Drawing.Size(261, 155);
this.Controls.Add(this.lblCalculatedLength);
this.Controls.Add(this.txtLength);
this.Controls.Add(this.lblToLength);
this.Controls.Add(this.lblFromLength);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnCalculate);
this.Controls.Add(this.cboConversions);
this.Controls.Add(this.Label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Conversions";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

internal System.Windows.Forms.Label lblCalculatedLength;
internal System.Windows.Forms.TextBox txtLength;
internal System.Windows.Forms.Label lblToLength;
internal System.Windows.Forms.Label lblFromLength;
internal System.Windows.Forms.Button btnExit;
internal System.Windows.Forms.Button btnCalculate;
internal System.Windows.Forms.ComboBox cboConversions;
internal System.Windows.Forms.Label Label1;
}
}

Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Conversions
{
public partial class Form1 : Form
{
//declare a rectangular array to store items
private static string[,] comboItems = new string[6, 2];
public Form1()
{
InitializeComponent();
}

private void btnExit_Click(object sender, EventArgs e)
{
this.Close();
}

private void Form1_Load(object sender, EventArgs e)
{
//add items to the array
comboItems[0, 0] = "Miles to Kilometers";
comboItems[0, 1] = "1.6093";
comboItems[1, 0] = "Kilometers to miles";
comboItems[1, 1] = "0.6214";
comboItems[2, 0] = "Feet to meters";
comboItems[2, 1] = "0.3048";
comboItems[3, 0] = "Meters to feet";
comboItems[3, 1] = "3.2808";
comboItems[4, 0] = "Inches to Centimeters";
comboItems[4, 1] = "2.54";
comboItems[5, 0] = "Centimeters to inches";
comboItems[0, 1] = "0.3937";
//add the items to the combo box
for (int i = 0; i < comboItems.GetLength(0); i++)
{
cboConversions.Items.Add(comboItems[i, 0]);
}
//select the first item on form load
cboConversions.SelectedIndex = 0;
}

private void cboConversions_SelectedIndexChanged(object sender, EventArgs e)
{
//change the text of labels and clear the textboxes based on items selected in the combo box
if (cboConversions.SelectedIndex == 0)
{
lblFromLength.Text = "Miles: ";
lblToLength.Text = "Kilometers: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 1)
{
lblFromLength.Text = "Kilometers: ";
lblToLength.Text = "Miles: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 2)
{
lblFromLength.Text = "Feet: ";
lblToLength.Text = "Meters: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 3)
{
lblFromLength.Text = "Meters: ";
lblToLength.Text = "Feet: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 4)
{
lblFromLength.Text = "Inches: ";
lblToLength.Text = "Centimeters: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}
else if (cboConversions.SelectedIndex == 5)
{
lblFromLength.Text = "Centimeters: ";
lblToLength.Text = "Inches: ";
lblCalculatedLength.Text = "";
txtLength.Text = "";
}

}

private void btnCalculate_Click(object sender, EventArgs e)
{
double lengthToBeConverted;
double convertedLength;
//check if iniput is valid
if (Double.TryParse(txtLength.Text, out lengthToBeConverted))
{
//convert the length and display it
convertedLength = lengthToBeConverted * Convert.ToDouble(comboItems[cboConversions.SelectedIndex, 1]);
lblCalculatedLength.Text = convertedLength.ToString("0.00");
}
//display error message when invalid input is entered
else
{
MessageBox.Show("Invalid input.", "Error");
txtLength.Focus();
}
}
}
}

Output Screens

Conversions Conversion: Meters to feet Meters: 500 Feet: 1640.40 Calculate Exit

Conversions Conversion: Inches to Centimeters Inches: 70 Centimeters: 177.80 Calculate Exit

Conversions Conversion: Kilometers to miles Kilomet 25 Miles: 15.54 Calculate Exit

Add a comment
Know the answer?
Add Answer to:
Project 10-1 Convert lengths In this assignment, you’ll add code to a form that converts the valu...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • In this exercise, you’ll add code to a form that converts the value the user enters...

    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...

  • UI: Provided Code: Public Class Form1 Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click...

    UI: Provided Code: Public Class Form1 Private Sub btnExit_Click(sender As Object, e As EventArgs) Handles btnExit.Click Me.Close() End Sub Private Sub btnCalculateDueDays_Click(sender As Object, e As EventArgs) Handles btnCalculateDueDays.Click End Sub End Class tick bitwise Or operation Work with dates and times Exercise 9-1 In this exercise, you'll use the Date Time and TimeSpan st I. Open the application th ructures. n that's in the CIVB 2015iChapter 09DateHandlin a form that accepts a future date a directory. Within this project,...

  • Programming Assignment PROGRAM NEEDS TO BE DONE IN C++ A furlong is a module of distance...

    Programming Assignment PROGRAM NEEDS TO BE DONE IN C++ A furlong is a module of distance equal to 220 yards (1/8 mile). Write two classes that implement distances in the following manner: The first class keeps track of distances as a whole number of furlongs, a whole number of yards, and a number of feet, which may have a fractional component. The second class keeps track of distances as a whole number of kilometers, followed by a number of meters,...

  • Zander Inc. stores employee IDs and salaries in a sequential access file named Employees.txt. Open the...

    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...

  • Visual Basic 2015: Extra 18-1 Use inheritance with the Inventory Maintenance Application Source Code: 1. frmNewItem.vb...

    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),...

  • Project 1, Program Design 1. Write a C program replace.c that asks the user to enter...

    Project 1, Program Design 1. Write a C program replace.c that asks the user to enter a three-digit integer and then replace each digit by the sum of that digit plus 6 modulus 10. If the integer entered is less than 100 or greater than 999, output an error message and abort the program. A sample input/output: Enter a three-digit number: 928 Output: 584 2. Write a C program convert.c that displays menus for converting length and calculates the result....

  • I need help with this C code Can you explain line by line? Also can you...

    I need help with this C code Can you explain line by line? Also can you explain to me the flow of the code, like the flow of how the compiler reads it. I need to present this and I want to make sure I understand every single line of it. Thank you! /* * Converts measurements given in one unit to any other unit of the same * category that is listed in the database file, units.txt. * Handles...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT