lilalfyalien
Member
- Joined
- Dec 11, 2007
- Messages
- 7
- Programming Experience
- 3-5
I have a form which I want to make a modal form (so that users have to interact with this form before any others). But not just in the scope of my program but in the scope of the OS.
Here's my code so far:
MAIN FORM
DIALOG FORM
How can I get the effect I want? Is there a way to track the cursor position and stop it from moving around outside of the window or is there an easier way?
Many thanks,
Here's my code so far:
MAIN FORM
VB.NET:
Public Class frmMain
Dim result As System.Windows.Forms.DialogResult
Private Sub frmMain_Activated(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
result = DialogForm.ShowDialog()
If result = Windows.Forms.DialogResult.OK Then
Me.Close()
End If
End Sub
End Class
DIALOG FORM
VB.NET:
Imports System.Windows.Forms
Public Class DialogForm
Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.OK
Me.Close()
End Sub
Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel_Button.Click
Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Close()
End Sub
End Class
How can I get the effect I want? Is there a way to track the cursor position and stop it from moving around outside of the window or is there an easier way?
Many thanks,