private void txtNroDocumento_TextChanged(object sender, EventArgs e) { int b = 0; string NroDoc = txtNroDocumento.Text; if (NroDoc.Length < 3) { return; } cCliente cli = new cCliente(); DataTable trdo = cli.GetClientesxNroDocumento(NroDoc); if (trdo.Rows.Count > 0) { if (trdo.Rows[0]["CodCliente"].ToString() != "") { Int32 CodCliente = Convert.ToInt32(trdo.Rows[0]["CodCliente"].ToString()); GetClientexCodigo(CodCliente); b = 1; } } if (b == 0) { txtCodCliente.Text = ""; txtApellido.Text = ""; txtNombre.Text = ""; } }