private void button1_Click(object sender, EventArgs e) { try { PantallaCarga f1 = new PantallaCarga(); cdm = comboBox1.SelectedItem.ToString(); grosor = (float)Convert.ToDouble(textBox2.Text); Close(); } catch (FormatException) { MessageBox.Show("Introduzca un número"); } catch (NullReferenceException) { MessageBox.Show("Introduzca un color de la lista"); } }
public void button1_Click(object sender, EventArgs e) { try { PantallaCarga f1 = new PantallaCarga(); int tb = Convert.ToInt32(textBox1.Text); if (tb > 255) { MessageBox.Show("Por favor, añada un valor del 0 al 255"); } else { byte a = Convert.ToByte(textBox1.Text); if (radioButton1.Checked == true) { posicion = 1; f1.SetIntensidad(a); } else if (radioButton2.Checked == true) { posicion = 2; f1.SetIntensidad(a); } else if (radioButton3.Checked == true) { posicion = 3; f1.SetIntensidad(a); } Close(); } } catch (FormatException) { MessageBox.Show("Debe introducir un valor en el recuadro"); } }