In Visual C#, visual studio 2015 environment, I am writing a program that is sup
ID: 3596749 • Letter: I
Question
In Visual C#, visual studio 2015 environment, I am writing a program that is supposed to use information placed by the user to a new form (DisplayForm.cs). Per instruction, I am using two classes: Customer.cs and PreferredCustomer.cs, which is derived from the customer.cs class. My main question follows the screen captures.
Form1.cs, main form
form1.cs code behind
when the display button is clicked, It is supposed to place the info in this form
DisplayForm.cs code behind
and following are my two classes
Customer.cs
PreferredCustomer.cs
How can I get the values to display in the display labels?? I cannot figure out where to put my code or how to properly reference the different forms.
DisplayForm.cs playForm.cs [Design] Form1.cs Forml.cs [Design] × Displayform.cs Preferred Customer Plan Full Name: Address: Phone Number: Amount Purchased: S ExitExplanation / Answer
You need to pass a instance of form 1 in DisplayForm.
Below are the code for form1 and displayForm
public partial class preferredCustomerPlan: Form
{
//Empty constructor for the designer
public preferredCustomerPlan()
{
InitializeComponent();
}
private void clearButton_Click(object sender, EventArgs e)
{
fullNameTextBox.Clear();
addressTextBox.Clear();
phoneNumberTextBox.Clear();
amountPurchasedTextBox.clear();
fullNameTextBox.Focus()'
}
private void exitButton_Click(object sender, EventArgs e)
{
this.close();
}
private void displayButton_Click(object sender, EventArgs e)
{
DisplayForm displayForm=new DisplayForm(); //make instance of DisplayHeader
displayForm.fullNameTextBox(fullNameTextBox.Text); //set the value of the field fullName
displayForm.addressTextBox(addressTextBox.Text); //set the value of the field address
displayForm.phoneNumberTextBox(phoneNumberTextBox.Text); //set the value of the field phoneNumber
displayForm.amountPurchasedTextBox(amountPurchasedTextBox.Text); //set the value of the amountPurchd
displayform.showDialog(); //show the displayform
}
}
}
public partial class DisplayForm: Form
{
//Empty constructor for the designer
public DisplayForm()
{
InitializeComponent();
}
set //this will set the value of the field into the field of displayForm
{
txtFullName.Text = value.fullNameTextBox;
txtAddress.Text = value.addressTextBox;
txtphoneNumber.Text = value.phoneNumberTextBox;
txtamountPurchased.Text=vale.amountPurchasedTextBox;
}
private void closeButton_Click(object sender, EventArgs e)
{
this.close();
}
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.