0
我試圖讓購買完整價格機票的人數與我的全價(5.50)相乘。當我按下計算按鈕後,我嘗試將此號碼放入我的Label7中。任何人都可以幫我做到這一點?乘法問題
這裏是我的代碼至今:
namespace Burren_Bus_Tours
{
public partial class BurrenBusToursForm : Form
{
public const double Full = 5.50;
public const double Discount = 3.75;
public BurrenBusToursForm()
{
InitializeComponent();
}
private void ButtonCalculate_Click(object sender, EventArgs e)
{
label5.Text = TextBoxDriversName.Text;
LabelDriver.Text = "Drivers Name:";
LabelRiders.Text = "Total Riders:";
LabelReceipts.Text = "Total Receipts:";
LabelAverageReceipts.Text = "Average Receipts per Rider:";
label6.Text = (double.Parse(TextBoxDiscountRiders.Text) + double.Parse(TextBoxFullFareRiders.Text)).ToString();
GroupBoxData.Visible = true;
嗨,我很新的編碼和C#。我試圖讓購買全價票的人數乘以我的全價(5.50)。當我按下計算按鈕後,我嘗試將此號碼放入我的Label7中。任何人都可以幫我做到這一點?謝謝! – DylanHig
幾件事情。 (1)查看風格指南https://docs.microsoft.com/en-us/dotnet/standard/design-guidelines/capitalization-conventions,以獲得有關如何變量,標籤等方面的好主意被大寫。 (2)我在'ButtonCalculate_Click'事件處理程序中看不到'label7'。你目前正在試圖填充該值?你會發現這個網站上的人不願意給你一個答案。目標是幫助你找到你已經嘗試過的缺陷。 – bcwiniger