using System.Collections.Generic;
Using System.Com ponentModel;
Using System. The Data;
Using System. Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
The namespace WindowsFormsApplication1
{
Public partial class Form1: Form
{
Public _click ()
{
InitializeComponent();
}
Private void button1_Click (object sender, EventArgs e)
{
Double DWJG=double. Parse (textBox1. Text);
Double mj=double. Parse (textBox2. Text);
Double DDXS=0;
Double LCXS=0;
Double LHJC=0;
Double CZDM=0;
Double bg=0;
Double ck=0;
Double xp=0;
Double yhxs=0;
Double jiagel=0;
String xingmingl=textBox3. Text. The Trim ();
String diduanl="";
String loucengl="";
String cizhuanl="";
String biguil="";
String lvhejinchuangl="";
String chekul="";
String xiaopengl="";
String yicixingl="";
String a=textBox3. Text + "Sir/madam, your purchase data as follows: \ n unit price:" + DWJG + "\ n building area:" + mj + "\ n";
If (radioButton1. Checked)
{
DDXS=0;
A=a + "you select the" + radioButton1. Text + "\ n";
Diduanl=radioButton1. Text;
}
If (radioButton2. Checked)
{
DDXS=0.06;
A=a + "you select the" + radioButton2. Text + "\ n";
Diduanl=radioButton2. Text;
}
If (radioButton3. Checked)
{
DDXS=0.08;
A=a + "you select the" + radioButton3. Text + "\ n";
Diduanl=radioButton3. Text;
}
If (comboBox1. SelectedIndex==0)
{
LCXS=0.05;
A=a + "you select the" + comboBox1. Text + "\ n";
}
If (comboBox1 SelectedIndex==1)
{
LCXS=0.035;
A=a + "you select the" + comboBox1. Text + "\ n";
}
If (comboBox1 SelectedIndex==2)
{
LCXS=0.04;
A=a + "you select the" + comboBox1. Text + "\ n";
}
If (comboBox1 SelectedIndex==3)
{
LCXS=0.045;
A=a + "you select the" + comboBox1. Text + "\ n";
}
If (comboBox1. SelectedIndex==4)
{
LCXS=0;
A=a + "you select the" + comboBox1. Text + "\ n";
}
If (comboBox1. SelectedIndex==5)
{
LCXS=0.05;
A=a + "you select the" + comboBox1. Text + "\ n";
}
Loucengl=comboBox1. SelectedItem. ToString ();
If (checkBox1. Checked)
{
LHJC=0.0008;
A=a + you select the "+" checkBox1. Text + "\ n";
Lvhejinchuangl="selected";
}
The else
Lvhejinchuangl="did not choose";
If (checkBox2. Checked)
{
LHJC=0.002;
A=a + "you select the" + checkBox2. Text + "\ n";
Cizhuanl="selected";
}
The else
Cizhuanl="did not choose";
If (checkBox3. Checked)
{
Bg=0.003;
A=a + "you select the" + checkBox3. Text + "\ n";
Biguil="selected";
}
The else
Biguil="did not choose";
If (checkBox4. Checked)
{
Ck=150000;
A=a + "you select the" + checkBox4. Text + "\ n";
Chekul="selected";
}
The else
Chekul="did not choose";
If (checkBox5. Checked)
{
Xp=10000;
A=a + "you select the" + checkBox5. Text + "\ n";
Xiaopengl="selected";
}
The else
Xiaopengl="did not choose";
If (radioButton4. Checked)
{
Yhxs=0.025;
A=a + "you select the lump-sum payment \ n";
Yicixingl="yes";
}
If (radioButton5. Checked)
{
Yhxs=0;
A=a + "you select the installment \ n";
Yicixingl="no";
}
Jiagel=(mj DWJG * * (1 + DDXS + LCXS + LHJC + CZDM + bg) + ck + xp) * (1 + yhxs);
String b=xingmingl + ", "+ mj. ToString () +", "+ +", "+ loucengl diduanl +", "+ +", "+ biguil cizhuanl + +", ", "" + lvhejinchuangl xiaopengl + chekul +", "+ + +", ", "" + yicixingl;
MessageBox. Show (a + "you choose to pay the total price is:" + jiagel + "RMB \ n" + b);
}
}
}
CodePudding user response:
Show the inside of the textBox1 text are not legal digital formatCodePudding user response:
You is not legitimate textbox1 double characters, maybe there is empty, or is a digital content, in double DWJG=double. Parse (textbox1. Text); Before do the textbox1. The judgment of the text, whether to do while the textbox1 input digital judgmentCodePudding user response:
Int a;If (int. TryParse (textBox1. Text, out a))//if for digital
{
//the number is
}
The else
{
//not Numbers
}