I know this is probably very basic, and I googled it and have gone through the search, but I'm having an issue which a very basic if/else scenario. The first statement produces results, which tells me that I've messed up the other statements somehow. It's driving me a little crazy. FYI, this is my first experience with a form window.
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 Wk2_Part1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int season;
int job;
season = Convert.ToInt32(textBox1.Text);
job = Convert.ToInt32(textBox2.Text);
if (season == 1)
if (job == 1)
label3.Text = "There is a 20% discount on the exterior job";
else
if (season == 2)
if (job == 1)
label3.Text = "There is a 20% discount on the exterior job";
else
if (season == 3)
if (job == 2)
label3.Text = "There is a 30% discount on the interior job";
else
label3.Text = "No discount, regular prices apply";
}
}
}
Aucun commentaire:
Enregistrer un commentaire