📄 addshiti.cs
字号:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Myschool
{
public partial class Addshiti : Form
{
public Addshiti()
{
InitializeComponent();
}
//窗体加载是读取数据
private void Addshiti_Load(object sender, EventArgs e)
{
//设值默认值
radA.Checked=true;
radOne.Checked=true;
//得到下拉框值
AddSubject.Additem(comsubject);
comsubject.SelectedIndex = 0;
}
private void btnsure_Click(object sender, EventArgs e)
{
//获得前台数据
string question=txtQuestion.Text;
string AnswerA = txtA.Text;
string AnswerB = txtB.Text;
string AnswerC = txtC.Text;
string AnswerD = txtD.Text;
string sure = "";
string deful = "";
string subject =Convert.ToString(comsubject.SelectedItem);
int i = Myschool.Select.SelectSubject(subject);
if ("" == question||""==AnswerA||""==AnswerB||""==AnswerC||""==AnswerD) {
MessageBox.Show("请输入完整信息!","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
return;
}
if (radA.Checked) {
sure = "A";
} if (radB.Checked) {
sure = "B";
} if (radC.Checked) {
sure = "C";
} if (radD.Checked) {
sure = "D";
} if (radOne.Checked) {
deful = "1";
} if (radTwo.Checked) {
deful = "2";
} if (radThree.Checked) {
deful = "3";
}
bool b = AddSubject.AddSubjects(question,AnswerA,AnswerB,AnswerC,AnswerD,sure,deful,i);
if (b)
{
MessageBox.Show("添加成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else {
MessageBox.Show("添加失败!","错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
private void btnclose_Click(object sender, EventArgs e)
{
this.Close();
}
private void btnnull_Click(object sender, EventArgs e)
{
txtQuestion.Text = "";
txtA.Text = "";
txtB.Text = "";
txtC.Text = "";
txtD.Text = "";
radA.Checked = true;
radOne.Checked = true;
comsubject.SelectedIndex = 0;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -