「ユーザーが [スコアを追加] メニュー項目をクリックすると、ドリンクの種類ごとのスコアがドリンクの合計に追加され、テキスト ボックスがクリアされ、フォーカスがリセットされます。」
上記の内容を追加する方法を見つけようとして立ち往生しています。私はそれを考えすぎて、実際よりも難しくしていると思います。
これが私がこれまでに行ったことです:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
namespace Lab6
{
public partial class NewTester : Form
{
private int AppleAde;
private decimal TotalScore;
private string Winner_Name = "";
int PrunePunch_Score;
int Total_Num_Of_Tasters;
decimal Average_Rating_Of_Each_Drink;
//private decimal Total_Score;
public NewTester()
{
Thread t = new Thread(new ThreadStart(SplashStart));
t.Start();
Thread.Sleep(5000);
InitializeComponent();
t.Abort();
}
public void SplashStart() {
Application.Run(new Form2());
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{
MessageBox.Show("Lab6 by J Soto \nThis lab was started on 10/9/13","About Lab 6",MessageBoxButtons.OK);
}
private void addYourScoresToolStripMenuItem_Click(object sender, EventArgs e)
{ // Vars for text box values...
PrunePunch_Score = Convert.ToInt32(PrunePunchTextBox.Text);
AppleAde = Convert.ToInt32(AppleAdeTextBox.Text);
//...
if ((PrunePunch_Score <= 10) && (PrunePunch_Score >= 0))
Convert.ToInt32(PrunePunchTextBox.Text);
else
MessageBox.Show("Please enter a number between 0 and 10","Prune Punch");
if ((AppleAde <= 10) && (PrunePunch_Score >= 0))
Convert.ToInt32(AppleAdeTextBox.Text);
else
MessageBox.Show("Please enter a number betwen 0 and 10","Apple Ade");
//...
}
private void PrunePunchTextBox_TextChanged(object sender, EventArgs e)
{
PrunePunch_Score = Convert.ToInt32(PrunePunchTextBox.Text);
}
private void AppleAdeTextBox_TextChanged(object sender, EventArgs e)
{
AppleAde = Convert.ToInt32(AppleAdeTextBox.Text);
}
private void summaryToolStripMenuItem_Click(object sender, EventArgs e)
{
string Summary;
// Summary= "Winner:"+ Winner_Name "Total Number of Taste Testers:" + Total_Num_Of_Tasters "Average rating for each drink:" + Average_Rating_Of_Each_Drink;
}
}
}