Public Class Form1
Private oskProcess As Process
Private Sub openButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles openButton.Click
If Me.oskProcess Is Nothing OrElse Me.oskProcess.HasExited Then
If Me.oskProcess IsNot Nothing AndAlso Me.oskProcess.HasExited Then
Me.oskProcess.Close()
End If
Me.oskProcess = Process.Start("osk")
End If
End Sub
Private Sub closeButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles closeButton.Click
If Me.oskProcess IsNot Nothing Then
If Not Me.oskProcess.HasExited Then
'CloseMainWindow would generally be preferred but the OSK doesn't respond.
Me.oskProcess.Kill()
End If
Me.oskProcess.Close()
Me.oskProcess = Nothing
End If
End Sub
End Class
Tag : .NET, Ms SQL Server 2008, VB.NET, VS 2010 (.NET 4.x)