How to hide a form on initialization

hey i have that problem too!!

i used divils method for vb.net

but it doesnt work


this is how it goes for my on closing event



Code:
    Private Sub frmMain_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
        If System.Environment.HasShutdownStarted = True Then
            Application.Exit()
        Else

            If Schedular.Settings.CloseButton = True Then
                Checks if the Close button setting is true
                If it is then
                e.Cancel = True
                Make close button to false, which is making it, its default role
                If MessageBox.Show("Are you sure you want to exit Task Schedular? If Task Schedular is closed all tasks will be inactive", "Confirm", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) = DialogResult.Yes Then
                    Schedular.Settings.StartedIntoTray = False
                    Schedular.Main.XMLCollection_Save()
                    Me.Dispose()
                    Disposes the form
                    End
                    Ends the entire application
                Else

                End If

            Else
                If the close button setting is false then
                e.Cancel = True
                Make the close button to true, which is making its role custom
                Select Case Schedular.Settings.ShowFrmMin
                    Selects the case of the setting ShowFrmMin
                Case True
                        If the setting is true then 
                        Me.Hide()
                        Hide the main form
                    Case False
                        If the setting is false then
                        Me.Hide()
                        Hide the form
                        Schedular.Forms.frmMain.ctxtTrayMenu.MenuItems.Item(0).Visible = False
                        Schedular.Forms.frmMain.ctxtTrayMenu.MenuItems.Item(1).Visible = False
                        Schedular.Forms.frmMain.ctxtTrayMenu.MenuItems.Item(2).Visible = False
                        Disable the menu items
                        Schedular.Forms.frmMain.TrayIcon.ShowBalloon(NotifyIcon2.NotifyIcon2.NotifyIcon2.EBalloonIcon.Info, "Task Schedular is still running!", "Palladium Info", 15000)
                        Display the balloon tip
                        Schedular.Forms.frmmin = New frmMin
                        Instantiate the form
                        Schedular.Forms.frmmin.TopMost = True
                        Make the form always on top
                        Schedular.Forms.frmmin.ShowDialog()
                        Display the the form as modal form
                        Schedular.Forms.frmmin = Nothing
                End Select
            End If
        End If
    End Sub



does anyone know whats the problem? it seems fine
 
Why did they publish in the MSDN the protected Methods
Originally posted by divil
I honestly have no idea. I can only imagine its a bug, thats why its fixed in version 1.1. You might be able to instantiate the class under 1.0 via reflection.
 
The documentation in MSDN is automatically generated from the source code.
 
I think you cant. The same as you cant use MessageBox in console apps?
I guess you cant use some classes in console while you can in windows app and vise versa...

In any case, you will have to use threads, because the app terminates if not havent some kind of event in the background. when I added the thread in my app and tried to log off, I got a message from windows that my program is not responding, even though I aborted the threads. In some reason, the SessionEnding event didnt trigger.
BUG? dont know.
 
The SessionEnding event did not trigger becuase Closing executes first, terminating the app. You put SessionEnding in your code just like any other event handler.
 
I think that there is a difference when you try the sessionending event when you are using the exe file or when you are testing it using the .NET compiler.
 
Maybe you have tested it more intensely than I did but I found that what I posted above was true. Because when I did not cancel the closing event SessionEnding was fired.
 
Oh, I wasnt talking about the closing event. Actually I dont even use it. I just said that Ii so different behavior when i used the exe file or by running the app from the .NET workspace.
 
well it worked
in that site i posted it stated that it is by all means hard to determine which even fires first
thus the need to overide the winprc
 
Sometimes SessionEnding triggers first, most of the time it does not, is what I found. So, it is just about useless.
 
Maybe they dont suppose to be togther?
After all, they have, ALL MOST the same behavior.
 
No, I dont think that the Closing event and SessionEnding event are good together. That is, depending on what you are doing in the Closing event.

But no matter, I think this thread is done.
 
Back
Top