private void addButton_Click(object sender, EventArgs e) { string student = "*PRIORITY*"; DialogResult result = new DialogResult(); result = MessageBox.Show("Was your reading on the second floor?", "Select Floor", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Floor2 form = new Floor2(student); form.ShowDialog(); } else { ThirdFloor form = new ThirdFloor(student); form.ShowDialog(); } createGrid(); }
private void studentListBox_SelectedIndexChanged(object sender, EventArgs e) { DialogResult dr = new DialogResult(); dr = MessageBox.Show("Please confirm your name\r\n" + studentListBox.SelectedItem.ToString(), "Confirmation", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { student = studentListBox.SelectedItem.ToString(); if (cleaning == false) { DialogResult result = new DialogResult(); result = MessageBox.Show("Was your reading on the second floor?", "Select Floor", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { Floor2 form = new Floor2(student); read.loadFloor(this, form); this.Close(); } else { ThirdFloor form = new ThirdFloor(student); read.loadFloor(this, form); this.Close(); } } else { ChoresForm form = new ChoresForm(student); form.ShowDialog(); this.Close(); } } else { MessageBox.Show("Please select your name."); return; } }