c# - 按下更新分数按钮时具有完全不同的表格
问题描述
这是一个使用多个表单的程序。
当我按下更新分数按钮时,我会得到一个完全不同的表格,称为分数。但是,一旦我输入名称和分数,score
按确定后会出现更新表格。
有什么方法可以将更新score
表单作为其独立表单而无需通过score
表单?
更新score
表格:
public UppDateScore()
{
InitializeComponent();
score link = new score();
DialogResult bUpdate = link.ShowDialog();
if (bUpdate == DialogResult.OK)
{
txtName.Text = link.tagName.ToString();
numberBox.Items.Add((string)link.Tagnumbers);
//TagNumbs2
numberBox.Items.Add((string)link.TagNumbs2);
// TagNumbers3
numberBox.Items.Add((string)link.TagNumbers3);
}
}
原始表格:
private void bUpdate_Click(object sender, EventArgs e)
{
UppDateScore update = new UppDateScore();
update.Show();
}
score
形式:
private void bClearScores_Click(object sender, EventArgs e)
{
txtName.Text = "";
txtScore.Text = "";
txtStoreScores.Text = "";
}
private void bOk_Click(object sender, EventArgs e)
{
string name = txtName.Text;
int score = Convert.ToInt32(txtScore.Text);
int amount = list[0]+ list[1]+list[2];
string test = null;
test = amount.ToString();
string msg = null;
msg = name;
//just get the name
string theName = null;
theName = name;
// just get the numbers you typed in
// first number
string aNumber = null;
int theNumbers1 = list[0];
aNumber = theNumbers1.ToString();
// sencend number
string theNumber2 = null;
int theNumbers2 = list[1];
theNumber2 = theNumbers2.ToString();
// third number
string theNumber3 = null;
int theNumbers3 = list[2];
theNumber3 = theNumbers3.ToString();
// get the amount in the list
string amountSize = null;
int scoreSize = list.Count;
amountSize = scoreSize.ToString();
// get the avarage
int avarge = amount / scoreSize;
string theAvarge = null;
theAvarge = avarge.ToString();
foreach (int s in list) {
msg += " | " + s.ToString();
}
解决方案
推荐阅读
- java - webdrivermanager 安装的 chrome 二进制文件不起作用
- javascript - 使用承诺和自定义事件同步窗口发布消息
- amazon-web-services - Ftp 文件夹到 S3 传输
- windows - 在 Windows 启动时执行特定的 Jupyter Lab Notebook
- carousel - 引导轮播左右按钮不起作用
- java - 为什么我不断获取数据库磁盘映像在 android studio 上格式错误
- r - ArcGis Rest API - 如何从 MapServer 获取栅格图层?
- algorithm - 什么是不会破坏先前排序的排序算法
- c# - 尝试从 PostgreSQL 获取时出错(提供了节点名或服务名,或未知)
- python - 如何同时使用 OneHotEncoder 和 LabelEncoder?