//-->Limpiar las cajas de texto (textBox del formulario) private void Limpiar() { this.txtNombre.Text = string.Empty; this.txtDirCli.Text = string.Empty; this.txtPoblacion.Text = string.Empty; this.txtCodPostal.Text = string.Empty; this.txtTelefono.Text = string.Empty; this.txtNumeroDocu.Text = string.Empty; this.dtFechaNac.Text = string.Empty; this.txtPerson.Text = string.Empty; //this.txtDescuento.Text = string.Empty; //->Valor por defecto a pintar en el campo this.txtDescuento.Text = "0,00"; this.txtCuenta.Text = string.Empty; this.txtEmail.Text = string.Empty; //-->Cargo el combo de los codigos postales DValidator.RellenoComboPostal(cbCodPostal); cbCodPostal.SelectedIndex = 0; //lo colocamos en la primera posicion con valores //-->Si tubiera una imagen, para dejarla vacia haria esto (Video : 14 Minuto : 05 ) // this.pxImagen.Image = global::CapaPresentacion.Properties.Resources.file; }
//----------------------// private void txtNumeroDocu_Validating(object sender, CancelEventArgs e) { int numero; char cReciLetra; int index; //-> Tratamiendo segun documento, tengo un código donde se trata el cálculo de la letra para // cada tipo de documento. //------------------------------------------------------------------------------------------ index = cbTipo_Documento.SelectedIndex; switch (index) { case 0: numero = Convert.ToInt32(txtNumeroDocu.Text); //cReciLetra = Convert.ToString(Validaciones.calcularLetra(numero)); cReciLetra = DValidator.calcularLetra(numero); MessageBox.Show("El resultado es: " + txtNumeroDocu.Text + cReciLetra); txtNumeroDocu.Text = txtNumeroDocu.Text + cReciLetra; break; case 1: MessageBox.Show("Es NIE"); break; case 2: MessageBox.Show("Es PASAPORTE"); break; default: MessageBox.Show("NO ES NINGUNO"); break; } }
//->Este es el evento de cambio de valor en el ComboBox lo obtengo haciendo dobleClick sobre el control en el formulario private void cbCodPostal_SelectedIndexChanged(object sender, EventArgs e) { if (cbCodPostal.SelectedIndex > 0) { string[] valores = DValidator.captar_info(cbCodPostal.Text.Substring(0, 5)); this.txtCodPostal.Text = valores[0]; this.txtPoblacion.Text = valores[1]; } }
private void txtnPorReq_KeyPress(object sender, KeyPressEventArgs e) { DValidator.NumerosDecimales(e); DValidator.ValiEnter(e); }
private void txtNumeroDocu_KeyPress(object sender, KeyPressEventArgs e) { DValidator.ValiEnter(e); }
private void cbTipo_Documento_KeyPress(object sender, KeyPressEventArgs e) { DValidator.ValiEnter(e); }
private void txtEmail_KeyPress(object sender, KeyPressEventArgs e) { DValidator.ValiEnter(e); }
private void dtFechaNac_KeyPress(object sender, KeyPressEventArgs e) { DValidator.ValiEnter(e); }
private void txtPoblacion_KeyPress(object sender, KeyPressEventArgs e) { DValidator.ValiEnter(e); }
private void txtCuenta_KeyPress(object sender, KeyPressEventArgs e) { DValidator.SoloNumeros(e); DValidator.ValiEnter(e); }