vb.net如何自动输入 vb中输入语句

VB.NET 向指定(网页或软件)的输入框内输入字符,如何实现?

假如Form1有个TextBox1,双击TextBox1填入123

成都创新互联2013年开创至今,先为西区等服务建站,西区等地企业,进行企业商务咨询服务。为西区企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。

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

怎么用vb调用记事本后,怎么使它自动输入一段文字

方法一:

Clipboard.SetText "123321"

Shell "notepad.exe /c "

方法二:

a = Shell("notepad.exe", vbNormalFocus)

AppActivate a

SendKeys "123321", True

如何VB.net实现浏览的网页自动填单

让网页自动填写表单操作步骤:

打开浏览器设置,点击打开【Internet选项】

在Internet选项卡上选择【内容】,点击自动完成下面的【设置】

在自动完成设置中勾选希望自动完成功能用于哪些方面,勾选前面的复选框即可

点击确定完成

如何用VB.NET制作账号自动登陆的程序

Private Sub SendBlogTimer_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SendBlogTimer.Tick

Dim textboxUserId As HtmlElement

Dim textboxPassword As HtmlElement

Dim buttonSubmit As HtmlElement

textboxUserId = SendBlogBrowser.Document.All("username")'获取用户名输入框

textboxPassword = SendBlogBrowser.Document.All("password")'获取密码输入框

buttonSubmit = SendBlogBrowser.Document.All("btnLogin")'获取登陆按钮

textboxUserId.SetAttribute("value","用户名")'给用户名输入框赋值

textboxPassword.SetAttribute("value","密码")'给密码框赋值

buttonSubmit.InvokeMember("click")’执行登陆按钮的单击

End Sub

其中的SendBlogBrowser为WebBrowser控件

vb.net 实现ComboBox输入字符自动补充字符

Public Sub AutoComplete(ByVal cmb As ComboBox, ByVal e As System.Windows.Forms.KeyPressEventArgs)

If cmb.DataSource Is Nothing Then

Return

End If

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then

Return

End If

Dim strFindStr As String = ""

If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Back) Then

If (cmb.SelectionStart = cmb.Text.Length) Then

If cmb.Text.Length  0 Then

strFindStr = cmb.Text.Substring(0, cmb.Text.Length - 1)

End If

Else

If cmb.SelectionStart  0 Then

strFindStr = cmb.Text.Substring(0, cmb.SelectionStart - 1)

End If

End If

e.Handled = False

Else

If (cmb.SelectionLength = 0) Then

strFindStr = cmb.Text + e.KeyChar

Else

If (cmb.SelectionStart = cmb.Text.Length) Then

strFindStr = e.KeyChar

Else

If cmb.SelectionStart  0 Then

strFindStr = cmb.Text.Substring(0, cmb.SelectionStart - 1) + e.KeyChar

Else

strFindStr = e.KeyChar

End If

End If

End If

End If

Dim intIdx As Integer = -1

Dim dv As DataView

If TypeOf (cmb.DataSource) Is DataTable Then

dv = CType(cmb.DataSource, DataTable).DefaultView

If strFindStr  "" Then

dv.RowFilter = cmb.DisplayMember  " Like '%"  strFindStr  "%'"

Else

dv.RowFilter = ""

End If

cmb.DataSource = dv

cmb.SelectedIndex = -1

cmb.Text = strFindStr

Else

dv = CType(cmb.DataSource, DataView)

If strFindStr  "" Then

dv.RowFilter = cmb.DisplayMember  " Like '%"  strFindStr  "%'"

Else

dv.RowFilter = ""

End If

cmb.DataSource = dv

cmb.SelectedIndex = -1

cmb.Text = strFindStr

End If

cmb.SelectionStart = strFindStr.Length

e.Handled = True

End Sub

Private Sub comboBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles comboBox1.KeyPress

AutoComplete(sender, e)

End Sub


标题名称:vb.net如何自动输入 vb中输入语句
网站URL:http://azwzsj.com/article/hgcjdj.html