private void txtNroDocumento_TextChanged(object sender, EventArgs e) { if (txtNroDocumento.Text.Length < 4) { return; } int b = 0; cCliente cli = new cCliente(); DataTable trdo = cli.GetClientexNroDoc(txtNroDocumento.Text); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodCliente"].ToString() != "") { txtCodCliente.Text = trdo.Rows[0]["CodCliente"].ToString(); txtNombre.Text = trdo.Rows[0]["Nombre"].ToString(); txtApellido.Text = trdo.Rows[0]["Apellido"].ToString(); txtTelefono.Text = trdo.Rows[0]["Telefono"].ToString(); if (trdo.Rows[0]["CodTipoDoc"].ToString() != "") { string CodTipoDoc = trdo.Rows[0]["CodTipoDoc"].ToString(); if (cmbTipoDoc.Items.Count > 0) { cmbTipoDoc.SelectedValue = CodTipoDoc; } } b = 1; } } if (b == 0) { txtCodCliente.Text = ""; txtNombre.Text = ""; txtApellido.Text = ""; txtTelefono.Text = ""; } }