my code is not working, can you tell me how to correct it please. 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 Final { public partial class Form1 : Form { static int count1 = 0, count2 = 0, count3 = 0, car1Sale = 0, car2Sale = 0, car3Sale = 0; public Form1() { InitializeComponent(); } private void checkBox1_CheckedChanged(object sender, EventArgs e) { chkPanel1(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void checkBox14_CheckedChanged(object sender, EventArgs e) { chkPanel2(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void button2_Click(object sender, EventArgs e) { foreach (Control cBox in this.panel1.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } foreach (Control cBox in this.panel2.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } foreach (Control cBox in this.panel3.Controls) { if (cBox is CheckBox) { ((CheckBox)cBox).Checked = false; } } clearAvailable(); } private void chkPanel1() { clearAvailable(); count1 = 0; foreach (Control c in this.panel1.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count1++; textBox1.Text = count1.ToString(); } } } } private void clearAvailable() { textBox10.Text = ""; textBox11.Text = ""; textBox12.Text = ""; textBox9.Text = ""; } private void chkPanel2() { clearAvailable(); count2 = 0; foreach (Control c in this.panel2.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count2++; textBox2.Text = count2.ToString(); } } } } private void chkPanel3() { clearAvailable(); count3 = 0; foreach (Control c in this.panel3.Controls) { if (c is CheckBox) { if (((CheckBox)c).Checked) { count3++; textBox3.Text = count3.ToString(); } } } } private void Form1_Load(object sender, EventArgs e) { chkPanel1(); chkPanel2(); chkPanel3(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void saleCalulate() { car1Sale = count1 * 300; car2Sale = count2 * 200; car3Sale = count3 * 100; textBox5.Text = "$" + car1Sale; textBox6.Text = "$" + car2Sale; textBox7.Text = "$" + car3Sale; textBox8.Text = "$" + Convert.ToString(car1Sale + car2Sale + car3Sale); } private void checkBox40_CheckedChanged(object sender, EventArgs e) { chkPanel3(); textBox4.Text = Convert.ToString(count1 + count2 + count3); saleCalulate(); } private void button1_Click(object sender, EventArgs e) { textBox9.Text = Convert.ToString(50 - (count1 + count2 + count3)); textBox10.Text = (10 - count1).ToString(); textBox11.Text = (20 - count2).ToString(); textBox12.Text = (20 - count3).ToString(); } } }

COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
1st Edition
ISBN:9780357392676
Author:FREUND, Steven
Publisher:FREUND, Steven
Chapter11: User Interfaces, Visual Basic For Applications (vba), And Collaboration Features
Section: Chapter Questions
Problem 12AYK
icon
Related questions
icon
Concept explainers
Question

my code is not working, can you tell me how to correct it please.

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 Final
{
public partial class Form1 : Form
{

static int count1 = 0, count2 = 0, count3 = 0, car1Sale = 0, car2Sale = 0, car3Sale = 0;
public Form1()
{
InitializeComponent();
}
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
chkPanel1();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();

}
private void checkBox14_CheckedChanged(object sender, EventArgs e)
{
chkPanel2();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}
private void button2_Click(object sender, EventArgs e)
{
foreach (Control cBox in this.panel1.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
foreach (Control cBox in this.panel2.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
foreach (Control cBox in this.panel3.Controls)
{
if (cBox is CheckBox)
{
((CheckBox)cBox).Checked = false;
}
}
clearAvailable();
}
private void chkPanel1()
{
clearAvailable();
count1 = 0;
foreach (Control c in this.panel1.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count1++;
textBox1.Text = count1.ToString();
}
}
}
}
private void clearAvailable()
{
textBox10.Text = "";
textBox11.Text = "";
textBox12.Text = "";
textBox9.Text = "";
}
private void chkPanel2()
{
clearAvailable();
count2 = 0;
foreach (Control c in this.panel2.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count2++;
textBox2.Text = count2.ToString();
}
}
}
}
private void chkPanel3()
{
clearAvailable();
count3 = 0;
foreach (Control c in this.panel3.Controls)
{
if (c is CheckBox)
{
if (((CheckBox)c).Checked)
{
count3++;
textBox3.Text = count3.ToString();
}
}
}
}
private void Form1_Load(object sender, EventArgs e)
{
chkPanel1();
chkPanel2();
chkPanel3();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}

private void saleCalulate()
{
car1Sale = count1 * 300;
car2Sale = count2 * 200;
car3Sale = count3 * 100;
textBox5.Text = "$" + car1Sale;
textBox6.Text = "$" + car2Sale;
textBox7.Text = "$" + car3Sale;
textBox8.Text = "$" + Convert.ToString(car1Sale + car2Sale + car3Sale);
}
private void checkBox40_CheckedChanged(object sender, EventArgs e)
{
chkPanel3();
textBox4.Text = Convert.ToString(count1 + count2 + count3);
saleCalulate();
}
private void button1_Click(object sender, EventArgs e)
{
textBox9.Text = Convert.ToString(50 - (count1 + count2 + count3));
textBox10.Text = (10 - count1).ToString();
textBox11.Text = (20 - count2).ToString();
textBox12.Text = (20 - count3).ToString();
}
}
}

o! Form1
CAR #1
groupBox2
CAR #3
A
B
Purchase infomation
1
SEATS TO PURCHASE
CAR #1:
CAR #2:
4
CAR #3:
Total seats to purchase: o
CAR #2
SE
PRICE
groupBox3
CAR #1 A D
$300
SEAT SALES:
CAR #1:
CAR #2
$200
2
CAR #2:
CAR #3 A В СD $100
CAR #3:
Total Sales:
5
Purchase
Clear
Seat infomation:
SEATS AVAILABLE/TOTAL:
TOTAL SEATS:
/50
CAR #1:
/10
CAR #2:
/20
CAR #3:
/20
3.
LO
Transcribed Image Text:o! Form1 CAR #1 groupBox2 CAR #3 A B Purchase infomation 1 SEATS TO PURCHASE CAR #1: CAR #2: 4 CAR #3: Total seats to purchase: o CAR #2 SE PRICE groupBox3 CAR #1 A D $300 SEAT SALES: CAR #1: CAR #2 $200 2 CAR #2: CAR #3 A В СD $100 CAR #3: Total Sales: 5 Purchase Clear Seat infomation: SEATS AVAILABLE/TOTAL: TOTAL SEATS: /50 CAR #1: /10 CAR #2: /20 CAR #3: /20 3. LO
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps

Blurred answer
Knowledge Booster
Design of User Interface
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
COMPREHENSIVE MICROSOFT OFFICE 365 EXCE
Computer Science
ISBN:
9780357392676
Author:
FREUND, Steven
Publisher:
CENGAGE L
Programming with Microsoft Visual Basic 2017
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:
9781337102124
Author:
Diane Zak
Publisher:
Cengage Learning
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT