Skip to content

Instantly share code, notes, and snippets.

@dmp3kl
Created September 3, 2019 18:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmp3kl/c98362c20665eeea00fa36aca0fbc076 to your computer and use it in GitHub Desktop.
Save dmp3kl/c98362c20665eeea00fa36aca0fbc076 to your computer and use it in GitHub Desktop.
txt_documentoKeypress
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