如何在控件中实现按回车相当于点击鼠标确认

PrivateSubCommandButton1_Click()UnloadMeEndSubPrivateSubListView1_DblClick()pm=ListVi... Private Sub CommandButton1_Click() Unload MeEnd SubPrivate Sub ListView1_DblClick() pm = ListView1.SelectedItem.Text Me.Hide MsgBox "双击:" & pmEnd SubPrivate Sub ListView1_KeyDown(KeyCode As Integer, ByVal Shift As Integer) If KeyCode = 13 Then MsgBox ListView1.SelectedItem.TextEnd Sub Private Sub TextBox1_Change() Dim Itm As ListItem, arr i = Sheet16.Cells(Rows.Count, 1).End(3).Row If i < 5 Then MsgBox "没有数据", 64, "提示": Exit Sub arr = Sheet16.Range("A5:p" & i) txt = Me.TextBox1.Text ReDim brr(1 To UBound(arr), 1 To 6) For y = 1 To UBound(arr) If InStr(arr(y, 2), txt) Then nc = nc + 1 For i = 1 To 4 brr(nc, i) = arr(y, i) Next If arr(y, 15) Then brr(nc, 5) = arr(y, 15) Else brr(nc, 5) = "" End If If arr(y, 16) Then brr(nc, 6) = arr(y, 16) Else brr(nc, 6) = "" End If End If Next With Me.ListView1 .ListItems.Clear If nc Then For n = 1 To nc Set Itm = .ListItems.Add() Itm.Text = brr(n, 1) For m = 1 To UBound(brr, 2) - 1 Itm.SubItems(m) = brr(n, m + 1) Next Next End If End WithEnd SubPrivate Sub UserForm_Initialize() Dim Itm As ListItem i = Sheet16.Cells(Rows.Count, 1).End(3).Row arr = Sheet16.Range("A5:p" & i) nrr = Array("品号", "物料名称", "规格型号", "单位", "结存数量", "结存金额") ReDim brr(1 To UBound(arr), 1 To UBound(nrr) + 1) For y = 1 To UBound(arr) For i = 1 To 4 brr(y, i) = arr(y, i) Next If arr(y, 15) Then brr(y, 5) = arr(y, 15) Else brr(y, 5) = "" End If If arr(y, 16) Then brr(y, 6) = arr(y, 16) Else brr(y, 6) = "" End If Next grr = Array(45, 100, 120, 28, 45, 55) Me.Width = 420 Me.ListView1.Width = 410 Me.ListView1.Left = 7.5 With Me.ListView1 .ColumnHeaders.Clear .ListItems.Clear For k = 0 To UBound(nrr) .ColumnHeaders.Add , , nrr(k), grr(k), lvwColumnLeft Next .Gridlines = True .View = lvwReport For n = 1 To UBound(arr) Set Itm = .ListItems.Add() Itm.Text = arr(n, 1) For m = 1 To UBound(brr, 2) - 1 Itm.SubItems(m) = brr(n, m + 1) Next Next End WithEnd Sub我的QQ是381129075 展开
 我来答
约定20125
2018-07-29 · TA获得超过1.5万个赞
知道大有可为答主
回答量:1.1万
采纳率:96%
帮助的人:2843万
展开全部
<input type="password" name="password" id="password" placeholder="请输入密码" onkeydown="keyLogin();">
function keyLogin(){
if (event.keyCode==13) //回车键的键值为13
submit(); //调用登录按钮的登录事件
}
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式