Total focus on a Form: ignore all others - vb.net

in my VB.NET application, my main Form can show other Forms. That works fine, but I need to set "focus" on the newly opened form, and don't allow the user use the main form until the opened Form is closed. How do I do that?

The Form.ShowDialog() method shows a form as a dialog box; this should keep the focus on that form until it is closed (by the user or your code).

Use the Form.ShowDialog() method.
It will show you the form as a dialog box, so focusing is at total, and it will ignore all other forms or objects.

Related

Maximized Main Form follows the restore window if I open another form, and I dont want that

I have a main form maximized in Access that I do not want to be in restore window or hidden or closed when another form opens.
I observed that when I open another form by DoCmd.Restore by clicking a button in the main form, the main form is also doing the restore window.
When I clicked a button in the main form, say Add Record, with DoCmd.Restore, my main form is doing a restore window rather than staying in maximized window
Any idea?
Thanks in advance
Your question is a bit confusing. If you don't want to un-maximize your forms, don't do DoCmd.Restore.
If you want to open another form non-maximized, but keep the main form maximized, you need to make the second form a popup form.
This is how MDI windows work - you can't have maximized and non-maximized forms at the same time - except popup forms.

Visual Basic Opening A Form [duplicate]

I have a login form which I need to close without the entire application being terminated. I tried using Me.Close() , Me.Hide() as well. The login form is used as the main form as well.
I hope this makes sense....
It sounds like you have a VB.Net project and your Login form is your 'startup form'. When you close that form, your application thinks it is over; but you really want to take action after the Login form is closed.
If you bring up the Properties window for the project, on the Applications Tab you can set the 'Shutdown mode'. The default is when the 'Startup Form Closes'. Change it to 'When the last form closes'.
You can also add Application level events here.
http://msdn.microsoft.com/en-us/library/f2bys999(v=vs.80).aspx
If you stick with the way you are going; your Login form is going to have to create another form before it closes or your app will close. You can do that; but it's probably cleaner to move the login logic into the Application Startup Event (see link for more details).
In the startup event you can show the Login screen, get the result, decide if you want to show the main form for your application, etc, etc...
This depends on where you are trying to close or hide the form. If you are trying to close or hide the form from within the the form itself then Me.Close() and Me.Hide() does the job. If you are attempting to close or hide a form from another form like your main form then you must refer to the form instance example:
frmAbout.Close()
frmAbout.Hide()
I hope this helps.

VB.NET - Navigating without loading another form

I'm currently developing a simple enrollment system for our school project. I have multiple modules that when clicked will open a new form with another set of sub modules.
However, I hate how forms load every time I open a new form. Is there like a way that when I clicked say for example "Enrollment" button, instead of loading a new form, it will change all the controls instead. Tried using User Control but it keeps crashing my program down after I created 2 user controls and load them in one form.
Main Form;
Enrollment Sub Form
Please help me guys.
As LarsTech mentioned I would use user controls instead of forms.
Each user control would be setup the same way as your form is, but can be loaded to a panel on the main form, allowing for a single form to show all content.
Dim myControl = New ControlYouCreated
panel1.Controls.Add(myControl)
myControl.bringtofront
This for example, will bring in the contents of the user control you created, into your form1 panel.

Keeping one form on top of the calling form

I'm using VB.NET (VS2008) and have a form (frmMain) that calls another form (frmCleanUp) but when frmCleanUp shows it can be hidden behind frmMain.
What I'd like to have is the new form be locked and have to close to get rid of it?
Thanks..
Show the Form with .ShowDialog() instead of .Show().
This way, the form is shown as modal dialog box and will stay on top until you close it.
when you show the form, do it with ShowDialog
in frmMain do:
frmCleanUp.ShowDialog

Suggestion window in mdi form

I have a problem stated below....
I have a MDI form having different child form. if i open the form then if related data not exist in database, a suggestion banner should appear top of the forms to enter related data first. Even, if I close the child form, suggestion banner should remain open and Onclick on that banner go to specific form to add the record. There should be different banner of different forms. so please help me to implement this scenario.
Thanks in Advance.
I want to use which control as banner. so after struggling i fount panel best as banner. Setting panel property -> AccessibleRole = Alert. So I implement scenario easily.
Instead of opening the child form, open the banner form first (which opens the child form).
Then check in the banner form if the data has been entered. If it has:- close the banner form.