组合框按键事件的问题 [英] Problem On Combo Box Key-press Event

查看:80
本文介绍了组合框按键事件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Private Sub cb_Sno_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles cb_Sno.KeyPress
       If e.KeyChar = ChrW(Keys.Enter) Then
           'If cb_Sno.SelectedIndex > -1 Then
           con.Open()
           cmd.Connection = con
           cmd.CommandText = "select * from TripSheet where SheetNo=" & cb_Sno.Text & ""
           dr = cmd.ExecuteReader
           While dr.Read
               cb_Sno.Text = dr(1)
               cb_vno.Text = dr(2)
               dtp_date.Value = dr(3)
               txt_skm.Text = dr(4)
               txt_ekm.Text = dr(5)
               txt_tkm.Text = dr(6)
               cb_dri1.Text = dr(7)
               cb_dri2.Text = dr(8)
               cb_Cleaner.Text = dr(9)
               txt_totfri.Text = dr(10)
               txt_totrcv.Text = dr(11)
               txt_totbal.Text = dr(12)
               txt_totload.Text = dr(13)
               txt_totunload.Text = dr(14)
               txt_totdie.Text = dr(15)
               txt_totamt.Text = dr(16)
           End While
           dr.Close()
      End If
  End Sub



当我按no并输入ENTER键时,组合框将清除并获得焦点.
详细信息不会显示.



When i press the no and enter the ENTER key, combo box cleared and get focus.
Details Won''t display.

推荐答案

使用Combobox.LeaveLostFocusValueChanged事件执行操作.

combobox事件 [
Use Combobox.Leave or LostFocus or ValueChanged events to perform your actions.

combobox events[^]


这篇关于组合框按键事件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆