Created
September 3, 2019 18:43
-
-
Save dmp3kl/c98362c20665eeea00fa36aca0fbc076 to your computer and use it in GitHub Desktop.
txt_documentoKeypress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void txt_documento_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
if (e.KeyChar == 13) | |
{ | |
string var = txt_documento.Text.ToString(); | |
if (var != "" || var !=" ") | |
{ | |
AbrirConexion(); | |
SqlCommand cdo = new SqlCommand(); | |
cdo.Connection = conexion; | |
cdo.CommandText = "select Codigo,Descripcion from zf_TipoDoc where Codigo='" + var + "'"; | |
SqlDataReader reader = cdo.ExecuteReader(); | |
while (reader.Read()) | |
{ | |
//cmbbox_documento.SelectedValue = reader[0].ToString(); | |
cmbbox_documento.SelectedItem = new Dato() { Codigo = reader[0].ToString(), Descripcion = reader[1].ToString() }; | |
} | |
reader.Close(); | |
CerrarConexion(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment