//boton busqueda nueva y limpieza variables private void BTN_NUEVA_BUSQ_Click(object sender, EventArgs e) { TB_PLACA.Clear(); TB_PLACA.Enabled = true; LBL_PLACA.ForeColor = System.Drawing.SystemColors.ActiveCaption; TB_FECHA.Clear(); LBL_FECHA.ForeColor = System.Drawing.SystemColors.ActiveCaption; TB_HORA.Clear(); LBL_HORA.ForeColor = System.Drawing.SystemColors.ActiveCaption; TB_RESPUESTA.Clear(); TB_RESPUESTA.Visible = false; BTN_NUEVA_BUSQ.Visible = false; placa = ""; placa_t = ""; fecha = ""; hora = ""; hora_1 = ""; min = ""; dia = ""; mes = ""; año = ""; }
//verificacion de datos ingresados de hora. private void TB_HORA_CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { int temp = 0, temp1 = 0, car_b = 0; hora = TB_HORA.Text; car_b = hora.Split(':').Length - 1; if ((hora.Length == 5) && (car_b == 1)) { hora_1 = hora.Substring(0, 2); min = hora.Substring(3, 2); if (int.TryParse(hora_1, out temp) && int.TryParse(min, out temp1) && (Convert.ToInt32(hora_1) < 25) && (Convert.ToInt32(min) < 60)) { TB_HORA.Enabled = false; // BTN_VERIFICAR.Focus(); BTN_VERIFICAR.Enabled = true; } else { Mensaje_error(error_hora); LBL_HORA.ForeColor = System.Drawing.SystemColors.ControlDarkDark; TB_HORA.Clear(); hora = ""; } } else { Mensaje_error(error_hora); LBL_HORA.ForeColor = System.Drawing.SystemColors.ControlDarkDark; TB_HORA.Clear(); hora = ""; } } }
//verificacion de datos ingresados de fecha. private void TB_FECHA_CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e) { if (e.KeyChar == (char)Keys.Enter) { int temp = 0, temp1 = 0, temp2 = 0, car_b = 0; fecha = TB_FECHA.Text; car_b = fecha.Split('/').Length - 1; if ((fecha.Length == 10) && (car_b == 2)) { dia = fecha.Substring(0, 2); mes = fecha.Substring(3, 2); año = fecha.Substring(6, 4); if (int.TryParse(dia, out temp) && int.TryParse(mes, out temp1) && int.TryParse(año, out temp2) && (Convert.ToInt32(año) >= DateTime.Now.Year)) { if ((Convert.ToInt32(año) % 4 == 0) && (Convert.ToInt32(año) != 0)) { if ((Convert.ToInt32(mes) == 2) && (Convert.ToInt32(dia) < 30)) { TB_FECHA.Enabled = false; TB_HORA.Enabled = true; TB_HORA.Clear(); TB_HORA.Focus(); } else if (Convert.ToInt32(mes) != 2) { TB_FECHA.Enabled = false; TB_HORA.Enabled = true; TB_HORA.Clear(); TB_HORA.Focus(); } else { Mensaje_error(error_fecha); LBL_FECHA.ForeColor = System.Drawing.SystemColors.ControlDarkDark; TB_FECHA.Clear(); fecha = ""; } } else { TB_FECHA.Enabled = false; TB_HORA.Enabled = true; TB_HORA.Clear(); TB_HORA.Focus(); } } else { Mensaje_error(error_fecha); LBL_FECHA.ForeColor = System.Drawing.SystemColors.ControlDarkDark; TB_FECHA.Clear(); fecha = ""; } } else { Mensaje_error(error_fecha); LBL_FECHA.ForeColor = System.Drawing.SystemColors.ControlDarkDark; TB_FECHA.Clear(); fecha = ""; } } }