下面好多熱心大佬一點我就通了 所以已解決 原來是int Sum1 = Numb1 + Convert.ToInt
32(Tbx4Dol2);
的Tbxdol2沒加到text
謝謝
http://sendvid.com/9i15m3gq
———-
大佬們好
小弟商學畢業 想轉職自己買課本來學C#
已經自己練習一週 目前遇到一些程式問題無法解決 麻煩請大佬們幫我看一下
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 電影院售票系統
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Lb1Price.Text = "單價";
Lb2Num.Text = "張數";
Lb3Dol.Text = "金額";
Lb4Ful.Text = "全票";
Lb5Che.Text = "優待票";
Lb6Sum.Text = "合計";
Lb7250.Text = "250";
Lb8200.Text = "200";
Tbx1Num1.Text = "";
Tbx2Num2.Text = "";
Tbx3Dol1.Text = "";
Tbx4Dol2.Text = "";
Tbx5sum1.Text = "";
Tbx3Dol1.ReadOnly = true;
Tbx4Dol2.ReadOnly = true;
Tbx5sum1.ReadOnly = true;
Tbx1Num1.MaxLength = 2;
Tbx2Num2.MaxLength = 2;
Tbx1Num1.TabIndex = 0;
Tbx3Dol1.Text = "0";
Tbx4Dol2.Text = "0";
}
private void Bul5Dol3_Click(object sender, EventArgs e)
{
}
private void Tbx1Num1_TextChanged(object sender, EventArgs e)
{
try
{
int Numb1 = Convert.ToInt32(Tbx1Num1.Text) *
Convert.ToInt32(Lb7250.Text);
Tbx3Dol1.Text = Numb1.ToString();
int Sum1 = Numb1 + Convert.ToInt32(Tbx4Dol2);
Tbx5sum1.Text = Sum1.ToString();
}
catch
{
Tbx3Dol1.Text = "0";
}
}
private void Tbx3Dol1_TextChanged(object sender, EventArgs e)
{
}
private void Tbx2Num2_TextChanged(object sender, EventArgs e)
{
try
{
int Numb2 = Convert.ToInt32(Tbx2Num2.Text) *
Convert.ToInt32(Lb8200.Text);
Tbx4Dol2.Text = Numb2.ToString();
int Total = Numb2 + Convert.ToInt32(Tbx3Dol1.Text);
Tbx5sum1.Text = Total.ToString();
}
catch
{
Tbx2Num2.Text = "0";
}
}
private void Tbx5sum1_TextChanged(object sender, EventArgs e)
{
}
private void Tbx1Num1_Enter(object sender, EventArgs e)
{
}
private void Tbx2Num2_Enter(object sender, EventArgs e)
{
}
}
}