求助现在写一个回车触发事件该怎么写啊
vb.net吧
全部回复
仅看楼主
level 11
一梦流痕 楼主
If 什么才能使回车触发??
2014年01月06日 06点01分 1
level 11
一梦流痕 楼主
[太开心]求大神帮忙
2014年01月06日 06点01分 2
level 11
一梦流痕 楼主
好吧 那个问题解决了不过又有新的问题了
2014年01月06日 06点01分 3
level 11
一梦流痕 楼主
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
Dim findstr As String, n As Integer
findstr = TextBox1.Text
n = ListBox1.FindStringExact(findstr)
If e.KeyChar = Chr(13) Then
If n >= 0 Then
ListBox1.SetSelected(n, True)
Else
If ListBox1.SelectedIndex >= 0 Then
ListBox1.SetSelected(ListBox1.SelectedIndex, False)
ListBox1.Items.Add(TextBox1.Text)
TextBox1.Text = ""
TextBox1.Focus()
End If
End If
End If
End Sub
2014年01月06日 06点01分 4
level 11
一梦流痕 楼主
我想使textbox中的文本在按下回车后添加到listbox并清空textbox可是我编完后按回车没反应?!
2014年01月06日 06点01分 5
level 11
一梦流痕 楼主
[乖]
大神们都放假了吗?
2014年01月06日 06点01分 6
level 11
一梦流痕 楼主
[乖]
2014年01月06日 08点01分 7
level 11
一梦流痕 楼主
话说本吧人气这么少啊
2014年01月06日 12点01分 8
level 11
一梦流痕 楼主
怎么还是没人啊~~!
2014年01月07日 08点01分 9
代码是在网上找的吧?或者别人给你的?
2014年01月07日 08点01分
回复 OneStep7 :我自己写的~~!怎么了?
2014年01月07日 10点01分
回复 一梦流痕 :如果这是你写的,代码看起来不合理啊!你觉得我说得对吗?
2014年01月07日 11点01分
回复 OneStep7 :我也觉的不对劲不过不会改啊,求指点
2014年01月07日 12点01分
level 11
这个挺简单的,你搞得这么复杂做什么~
2014年01月08日 04点01分 10
这不是刚学么,还没那么厉害···!
2014年01月08日 05点01分
level 10
在控件的 keydown 事件中而不要在 keypress 事件中检测
2014年01月14日 06点01分 12
3q,以解决
2014年01月14日 11点01分
level 2
你这是文本框的按键事件,你是不是想‘在按下键盘某键时触发此事件’但前提是这个文本框必须得到了焦点才能触发这个事件!
2014年03月04日 17点03分 13
1