Independent_Pie6058
Independent_Pie6058

Reputation: 43

How to disable main form when another form is open in vb

I'm working on my project in VB. Can anyone help me how to disable my main(not close) form when I open my login form?

Like when I click on the login button the login form will appear and the main form will just stay in background and it cannot be closed or moved unless the login form will be closed?

Upvotes: 3

Views: 5956

Answers (1)

ChicagoMike
ChicagoMike

Reputation: 618

Look into the subject of a "modal" dialog box. You can instantiate one as follows:

Dim frmLogin as New Form()
' Display frmLogin as a modal dialog
frmLogin.ShowDialog()

This means that this form will have to be handled by the user before any other forms can be used.

Upvotes: 5

Related Questions