How to hide main form in VB - vb.net

My goal is this: Program opens, small form initializes things, displaying text status updates as it does this, and when its done, it goes away and the actual main program form appears, allowing you to use it. Ive tried Me.Hide() and Me.Visible = False however both leave the initial small form open, with the actual program opened directly behind it. The small form is set as the main form to open to in VB config.

You can use a workaround. It will minimize the form and hide it from taskbar:
Me.WindowState = FormWindowState.Minimized
Me.ShowInTaskbar = False
Later, when you want to exit the application, do it in standard way: by closing this (hidden) form.

Related

Endless form not showing after filter applied previously

I am using unbound endless forms to display data from my database.
The data source is set to queries which provide data to show on the form.
All tinkering with the data itself on the form is blocked (entry, adding, deleting, etc.).
The data on the form can, however, be filtered through Access' standard ways (right clicking on the data and selecting the options or through the navigation buttons down the bottom of the form).
I am using another unbound form as a menu. Buttons on the form let the user open the data display forms. The buttons are connected to the forms through an on- click event that triggers a DoCmd.OpenForm ("frmOutput") line of code to display the form.
Recently I've had users report, that opening the endless data display forms from the menu, filtering data on the form and then closing the form without taking the filter out has resulted in the form not being able to be opened again from the menu (clicking the respective button results in no action whatsoever). The bug seems to even save to the application somehow and moving the (frontend) file to another machine still shows the same error of not showing the form.
It seems that the bug appears more often when people use multiple screens, and use the application on their second screen (as per their Windows settings).
Does anybody know what causes the bug or how it can be prevented?
Any pointer in the right direction is much appreciated since I am at a loss where to even start looking for the culprit!
Hard to tell but it sounds like their filter is being saved when form is closed
If you already have an event that opens the form, try to just clear the filter property after it opens. You can do this from all your command buttons by just changing the form name that gets passed to it
Private Sub OpenUnfilteredForm(strFormName as String)
Dim frm As Form
DoCmd.OpenForm (strFormName)
DoEvents
If CurrentProject.AllForms(strFormName).IsLoaded Then
Set frm = Forms(strFormName)
With frm
.Filter = ""
.FilterOn = False
End With
End If
Set frm = Nothing
End Sub

How to stop VB.Net FixedToolWindows getting maximized

I have an application with several FixedToolWindow forms and one Sizable window form inside MDIParent form which runs maximized. If i run FixedToolWindows while Sizable window is unloaded, FixedToolWindows runs with correct sizes.
But if I try to run a FixedToolWindow while the Sizable window running in maximized mode, all the FixedToolWindows gets maximized too.
Following is the code, i use to load forms,
If Application.OpenForms().OfType(Of frmFrontEndLED).Any Then
MessageBox.Show("Already opened")
Else
Dim frmFendLED As New frmFrontEndLED()
'Set the Parent Form of the Child window.
frmFendLED.MdiParent = Me
'Display the New form.
frmFendLED.TopMost = True
frmFendLED.Show()
End If
What am i doing wrong?. How can i correct this?

close form when application loses focus

My form is displayed as TopMost on my application. The problem I have is that whenever I minimize my application or it loses focus, the form remains displaying. I want to be able to minimize my application or move to another and also hide or close my form. Once the application regains the focus, then unhide or open the form again.
Here is what I worked out on the form's closing event:
Private Sub frmNavigation_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Static Minimize As Boolean
If Minimize = True Then
e.Cancel = True
Me.Hide()
End If
End Sub
I tried using the same code in the applications WindowDeactivate event but nothing happens.
You do not show how you create the instance of your frmNavigation. I am assuming that you are using the Show Method, so just use the version of Show that you pass in the top level window. That will assign the owner of the form, it will then stay on top of your Main Form and minimize and restore with it also. If this doesn't work please show how you are creating and showing your form.
frmNavigation.Show(Me)
I was able to find an answer to the question. MSDN had an article on this very issue.
it can be found here: http://support.microsoft.com/kb/186908#appliesto

Form maximize on another form

I have an MDI application which contains many child forms
My problem is, on clicking a particular menu, I am opening a form with maximize window in the MDI form. This works fine.
Now if I open another form above the first one, and if i want the second form to be of normal size, i am unable to do it.
Second form also opens with maximized window similar to first one. I want the second form to be of normal small size.
I want to show second form normally and first form maximized.
How can i do that?
Private Sub TESTToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles TESTToolStripMenuItem.Click
Dim f As New newCalendar2("UGHARANI")
f.Show()
f.MdiParent = Me
f.WindowState = FormWindowState.Maximized
End Sub
Okay, I think I understand what you're trying to accomplish: you want the first (data) form to be a kind of background to your MDI application and have the other forms display on top of it, right?
Well one way to do it might be to remove borders from the background form –FormBorderStyle = None– and fill-dock it in the MDI parent form. Although it would end up coming to the fore and hiding all your other forms if a user clicked anywhere on it. But if it doesn't require any user interaction you could always use its Activate event to send it back to the background, using Me.SendToBack().

Form not brought to front when dragged

I have created a list form that gets attached to a main form in VB.NET. This all works fine except that when the main form gets activated, I need the list to be brought to the front as well. I have put in a simple IF function to do this but when I added these lines of code, the main form, as well as the list form now do not get brought to the front until you let go of the mouse button. Obviously this means that if you drag the form, it stays at the back until you let go of the mouse button.
The code that I added is below:
If CRL.Visible = True Then
CRL.BringToFront()
End If
CRL is the list form.
If I comment out this code again, the main form get brought to the front while dragging but obviously the list form does not. The main form as well as the list form are MDI children.
You trick it by topmost property:
If CRL.Visible = True Then
CRL.BringToFront()
CRL.TopMost = True
Application.DoEvents
CRL.TopMost = False
End If