Извинения за действительно длинный код. Мои две кнопки, taskpagebackbtn и taskpagenextbtn не похожи на то, что их вызывают. Я установил окно сообщения, и оно не показывалось, но я не уверен, почему они не вызываются, потому что, когда я открываю свою форму, когда я нажимаю кнопки, они, кажется, не работают.
public partial class Task_Page : Form
{
TextBox[] subjectnamearray { get; set; }
List<string> datatablesubjectnamearray { get; set; }
int numofsubjects { get; set; }
public Task_Page(TextBox[] subjectnamearray, List<string> datatablesubjectnamearray, int numofsubjects)
{
InitializeComponent();
numoftasks.SelectedIndexChanged += (sender2, e2) => numoftasks_SelectedIndexChanged(sender2, e2,subjectnamearray, datatablesubjectnamearray, numofsubjects);
}
private void taskpagebackbtn_Click(object sender, EventArgs e)
{
this.Hide();
var SubjectPage = new SubjectPage();
SubjectPage.Closed += (s, args) => this.Close();
SubjectPage.Show();
SubjectPage.StartPosition = FormStartPosition.Manual;
SubjectPage.Location = new Point(this.Location.X, this.Location.Y);
}
private void taskpagenextbtn_Click(object sender, EventArgs e)
{
Marks_and_Weighting_Table marksandweightingtable = new Marks_and_Weighting_Table(subjectnamearray, datatablesubjectnamearray, numofsubjects);
foreach (Control control in this.Controls)
{
if (control is TextBox)
{
if (control.Text.Trim() == string.Empty)
{
MessageBox.Show("Please fill out all textboxes.", "Error Message");
/*https://www.codeproject.com/Questions/496674/EmptyplusTextboxplusValidationplusinplusC*/
return;
}
}
}
this.Hide();
var MarksandWeightingTable = new Marks_and_Weighting_Table(subjectnamearray, datatablesubjectnamearray, numofsubjects);
MarksandWeightingTable.Closed += (s, args) => this.Close();
MarksandWeightingTable.Show();
MarksandWeightingTable.StartPosition = FormStartPosition.Manual;
MarksandWeightingTable.Location = new Point(this.Location.X, this.Location.Y);
}
private void numoftasks_SelectedIndexChanged(object sender, EventArgs e, TextBox[] subjectnamearray, List<string> datatablesubjectnamearray, int numofsubjects)
{
lblsubjectname1.Text = subjectnamearray[0].Text;
lblsubjectname2.Text = subjectnamearray[1].Text;
lblsubjectname3.Text = subjectnamearray[2].Text;
lblsubjectname4.Text = subjectnamearray[3].Text;
lblsubjectname5.Text = subjectnamearray[4].Text;
lblsubjectname6.Text = subjectnamearray[5].Text;
/*/1556746/c-net-izmenit-tekst-metki*/