给你个参考的例子,窗体打开时可能大小有变化,软件名可能有变化
创新互联建站专业为企业提供藁城网站建设、藁城做网站、藁城网站设计、藁城网站制作等企业网站建设、网页设计与制作、藁城企业网站模板建站服务,十载藁城做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
先加个控件ListBox1,运行后双击ListBox1上程序名
Public Class Form1
Public myProcess() As Process
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myProcesses() As Process = Process.GetProcesses()
Dim jh As New ArrayList
For Each bs As Process In myProcesses
If CInt(bs.MainWindowHandle) 0 Then
ListBox1.Items.Add(bs.ProcessName)
jh.Add(bs)
End If
Next
ReDim myProcess(jh.Count - 1)
jh.CopyTo(myProcess)
End Sub
Declare Function ShowWindow Lib "user32" Alias "ShowWindow" (ByVal hwnd As Integer, ByVal nCmdShow As Long) As Integer
Private Sub ListBox1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListBox1.MouseDoubleClick
Dim a As Process = myProcess(ListBox1.SelectedIndex)
Try
Dim dd = ShowWindow(a.MainWindowHandle, H1)
AppActivate(a.Id)
Catch ex As Exception
End Try
End Sub
End Class
这样不好,应该使用 Table 键,按照 Table 键顺序来切换。因为回车往往用来确定你要按下页面的确定按钮。如果非要使用回车:
Private Sub 文本框按下回车键(sender As Object, e As KeyEventArgs) Handles TextBox3.KeyDown, TextBox2.KeyDown, TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
Select Case sender.name
Case "TextBox1"
TextBox2.Focus()
Case "TextBox2"
TextBox3.Focus()
Case "TextBox3"
TextBox1.Focus()
End Select
End If
End Sub
Public RunProcess As Process
RunProcess.start("djiwqjidjwqi")
AppActivate(RunProcess.Id())
网站名称:vb.net焦点切换 vb设置焦点
本文路径:https://www.cdcxhl.com/article2/dosdeic.html
成都网站建设公司_创新互联,为您提供网站设计公司、外贸建站、网站排名、品牌网站制作、网站建设、建站公司
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联