private void showButton_Click(object sender, EventArgs e) { try { if (myFiles.Count > 0 && Int32.Parse(textBox1.Text.ToString()) > 0) { Slides slideShow = new Slides(myFiles, Int32.Parse((textBox1.Text.ToString()))); } else if (myFiles.Count <= 0) { MessageBox.Show("No images to show", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (Int32.Parse(textBox1.Text.ToString()) <= 0) { MessageBox.Show("Please enter an integer time interval > 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show("Please enter an integer time interval > 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void Show_button_Click(object sender, EventArgs e) { //No items in listbox if (listBox1.Items.Count == 0) { MessageBox.Show("No images to Show.", "Info", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } try { //call the slide form Slides slide = new Slides(interval_textBox.Text, listBox1.Items); slide.ShowDialog(); } //invalid time interval catch { MessageBox.Show("Please enter an integer time interval > 0.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } }
private void showButton_Click(object sender, EventArgs e) { try { if (myFiles.Count > 0 && Int32.Parse(textBox1.Text.ToString()) > 0) { Slides slideShow = new Slides(myFiles, Int32.Parse((textBox1.Text.ToString()))); } else if (myFiles.Count <= 0) { MessageBox.Show("No images to show", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (Int32.Parse(textBox1.Text.ToString()) <= 0) { MessageBox.Show("Please enter an integer time interval > 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch(Exception ex) { MessageBox.Show("Please enter an integer time interval > 0", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }