VB中设置+,-,*,/,为快捷键,,但当光标中文本框中时,除了响应我指定的快键还输入到了文本框,
展开全部
那方法就是——光标(焦点)一旦移到文本框中,立刻让焦点换到另一个按钮上。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
给文本框(假设Text1)增加以下代码即可:
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "+" Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "*" Or Chr(KeyAscii) = "/" Then KeyAscii = vbNull
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) = "+" Or Chr(KeyAscii) = "-" Or Chr(KeyAscii) = "*" Or Chr(KeyAscii) = "/" Then KeyAscii = vbNull
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
可以加判断语句的啊
pirvate sub text1_change()
if right(text1.text,1)="+" or "-" or "*" or "/" then
text1.text=left(text1.text,len(text1.text)-1)
响应内容
end if
end sub
pirvate sub text1_change()
if right(text1.text,1)="+" or "-" or "*" or "/" then
text1.text=left(text1.text,len(text1.text)-1)
响应内容
end if
end sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Public Declare Function RegQueryValueExString Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Public Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long
Public Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Long, lpcbData As Long) As Long
Public Declare Function RegSetValueExString Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long
Public Declare Function RegQueryValueExLong Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long
Public Declare Function RegQueryValueExNULL Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As Long, lpcbData As Long) As Long
Public Declare Function RegSetValueExString Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpValue As String, ByVal cbData As Long) As Long
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Text1_KeyPress(KeyAscii As Integer)
If InStr("+-*/", Chr(KeyAscii)) > 0 Then KeyAscii = 0
End Sub
If InStr("+-*/", Chr(KeyAscii)) > 0 Then KeyAscii = 0
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询