c#高手进来帮我看看
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Da...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double x = double.Parse(textBox1.Text);
double y = double.Parse(textBox2.Text);
double z;
if (radioButton1.Checked) z = x + y;
else if (radioButton2.Checked) z = x - y;
else if (radioButton3.Checked) z = x * y;
else z = x / y;
textBox3.Text = z.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
double x = double.Parse(textBox1.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
double y = double.Parse(textBox2.Text);
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
double z = double.Parse(textBox3.Text);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Text="被加数";
label2.Text = "加数";
label3.Text="和数";
label4.Text = "+";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被减数";
label2.Text = "减数";
label3.Text = "差数";
label4.Text = "-";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被乘数";
label2.Text = "乘数";
label3.Text = "积数";
label4.Text = "*";
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被除数";
label2.Text = "除数";
label3.Text = "商";
label4.Text = "/";
}
private void button_exit_Click(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
}
}
程序能跑,但是运行了一半在
double x = double.Parse(textBox1.Text);
里出现
{"输入字符串的格式不正确。"}的错误 展开
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double x = double.Parse(textBox1.Text);
double y = double.Parse(textBox2.Text);
double z;
if (radioButton1.Checked) z = x + y;
else if (radioButton2.Checked) z = x - y;
else if (radioButton3.Checked) z = x * y;
else z = x / y;
textBox3.Text = z.ToString();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
double x = double.Parse(textBox1.Text);
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
double y = double.Parse(textBox2.Text);
}
private void textBox3_TextChanged(object sender, EventArgs e)
{
double z = double.Parse(textBox3.Text);
}
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
label1.Text="被加数";
label2.Text = "加数";
label3.Text="和数";
label4.Text = "+";
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被减数";
label2.Text = "减数";
label3.Text = "差数";
label4.Text = "-";
}
private void radioButton3_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被乘数";
label2.Text = "乘数";
label3.Text = "积数";
label4.Text = "*";
}
private void radioButton4_CheckedChanged(object sender, EventArgs e)
{
label1.Text = "被除数";
label2.Text = "除数";
label3.Text = "商";
label4.Text = "/";
}
private void button_exit_Click(object sender, EventArgs e)
{
}
private void button1_Click_1(object sender, EventArgs e)
{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
}
}
}
程序能跑,但是运行了一半在
double x = double.Parse(textBox1.Text);
里出现
{"输入字符串的格式不正确。"}的错误 展开
2个回答
AiPPT
2024-09-19 广告
2024-09-19 广告
随着AI技术的飞速发展,如今市面上涌现了许多实用易操作的AI生成工具1、简介:AiPPT: 这款AI工具智能理解用户输入的主题,提供“AI智能生成”和“导入本地大纲”的选项,生成的PPT内容丰富多样,可自由编辑和添加元素,图表类型包括柱状图...
点击进入详情页
本回答由AiPPT提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询