假如Form1有个TextBox1,双击TextBox1填入123
为铁锋等地区用户提供了全套网页设计制作服务,及铁锋网站建设行业解决方案。主营业务为成都网站制作、成都网站设计、铁锋网站设计,以传统方式定制建设网站,并提供域名空间备案等一条龙服务,秉承以专业、用心的态度为用户提供真诚的服务。我们深信只要达到每一位用户的要求,就会得到认可,从而选择与我们长期合作。这样,我们也可以走得更远!
Public Class Form1
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Integer, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
System.Windows.Forms.SendKeys.Send("123")
End Sub
End Class
看你的VB.NET 版本了
用 My.Computer.Keyboard.SendKeys("123", True) 代替 System.Windows.Forms.SendKeys.Send("123") 也可以
原码:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
Private Sub TextBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.DoubleClick
My.Computer.Keyboard.SendKeys("123", True)
End Sub
End Class
你可在需输入特殊字符时启动WORD,利用WORD的插入(I)菜单下的符号(S)或特殊符号(Y)内,找到你需的特殊字符,临时放于WORD文本上,用复制粘贴法放入VB的代码内,例:
Option Explicit
Dim i As Integer
Private Sub Form_Load()
For i = 0 To 1
Print "√"
Next i
End Sub
Private Sub Text1_Change()
For x = 0 To List1.ListCount - 1
If Text1.Text = List1.List(x) Then
List1.Selected(x) = True
End If
Next x
End Sub