-1

I have two forms, let's call them form1 and form2. User opens a form2 by clicking on a button on form1. When the form 2 opens, I want to disable that user can click on a form1 and do whatever he wants. I want him to first finish the job on form2 and after he closes the form2 messing around with form1 becomes available again.

It can probably be done somehow by using an events called LostFocus and GotFocus, but I don't know how.

I hope someone will help me.

4

1 回答 1

0

It sounds like you want Form2 to be "modal". You should be able to achieve this by using ShowDialog() when displaying the form:

Public Sub ShowMyDialogBox()

    Dim testDialog As New Form2()

    If testDialog.ShowDialog(Me) = System.Windows.Forms.DialogResult.OK Then 
        ' Do something based on the return status of the form
    Else
        ' Do something else based on the return status of the form, etc.
    End If

    testDialog.Dispose()

End Sub
于 2013-03-31T02:13:33.307 回答