private void SoCau_text_TextChanged(object sender, EventArgs e) { if (comboBox1.Text == "PART I") { if ((P1_SoCau > 0) && (P1_SoCau < 51)) { LastCheckDisplay(); PicAddr = PathText.Text + "PartI_Pic" + P1_SoCau.ToString() + ".JPG"; pictureBox1.ImageLocation = PicAddr; SoundAddr = PathSound.Text + "PartI_Sound" + P1_SoCau.ToString() + ".wav"; Sound = new SoundPlayer(SoundAddr); Sound.Play(); } else { MessageBox.Show("Numbers are out of range (1 - 50)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if ((P2_SoCau > 0) && (P2_SoCau < 101)) { LastCheckDisplay(); PicAddr = PathText.Text + "PartII_Pic" + P2_SoCau.ToString() + ".JPG"; pictureBox1.ImageLocation = PicAddr; SoundAddr = PathSound.Text + "PartII_Sound" + P2_SoCau.ToString() + ".wav"; Sound = new SoundPlayer(SoundAddr); Sound.Play(); } else { MessageBox.Show("Numbers are out of range (1 - 100)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }
private void Previous_Click(object sender, EventArgs e) { if (comboBox1.Text == "PART I") { if (P1_SoCau > 1) { P1_SoCau--; SoCau_text.Text = P1_SoCau.ToString(); } else { MessageBox.Show("Numbers are out of range (1 - 50)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { if (P2_SoCau > 1) { P2_SoCau--; SoCau_text.Text = P2_SoCau.ToString(); } else { MessageBox.Show("Numbers are out of range (1 - 100)", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } }