|
-
Mar 21st, 2011, 05:03 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Showing/Hiding a Form on Windows Server 2008 RD Web Acess
Hello Everyone,
I'm having an issue with my app where IE will get brought to the front of the screen when I am switching between forms. Basically I have a form with the man menu which consist of a few command buttons that will start up another form once a user clicks on the button. I do not want the users loading up multiple forms in my application, so once they load one form I end up hiding the main form. So my code looks as shown below when a button is clicked.
Code:
Private Sub cmdInvoiceMaintenance_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInvoiceMaintenance.Click
Me.SuspendLayout()
'Show the Invoice Maintenance Form.
frmInvoiceMaintenance.Show()
'Hide the main menu form.
Me.Hide()
Me.ResumeLayout()
End Sub
This is working perfectly fine on our current terminal servers that are running Windows 2003. We are in the process of upgrading to terminal servers that are running Windows 2008 RD, which you launch using Internet Explorer. What I've notice now is switching between forms the screen will flicker because it seems to hide the main form before the Invoice Maintenance form is fully displayed. What's worse is it will sometimes hide the main form and then IE will come up to the front of the screen and the Invoice Maintenance screen will be behind it. Then I am forced to click on the Invoice Maintenance screen within the Task Bar to get it to come to the front. This only happens if I leave IE open in the background. If I happen to minimize it, it'll still flicker between forms but it will not bring up say Outlook or any other app I might be running behind my application.
Has anyone else experienced this problem, or anyone have any ideas how I can resolve this issue?
Thank You,
Greg
Last edited by Maldrid; Mar 23rd, 2011 at 01:07 PM.
Reason: To change title to Resolved.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Mar 21st, 2011, 05:09 PM
#2
Thread Starter
Fanatic Member
Re: Showing and Hiding a form
Also I am using Visual Studio 2005 and currently on .NET 2.0 just in case anyone needs that info.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Mar 21st, 2011, 07:54 PM
#3
Re: Showing and Hiding a form
You may find it helps to make the main form the Owner of the dialog form -- for example by using frmInvoiceMaintenance.Show(Me). That prevents other windows from getting between the two forms. Then you could fade the main form's Opacity to 0 instead of hiding it. BB
-
Mar 22nd, 2011, 09:47 AM
#4
Thread Starter
Fanatic Member
Re: Showing and Hiding a form
But then I run into several windows showing up on the task bar.
From the main window you can go into a window and then from that window you can go into a third window and so forth depending on the module the user went into and how much detail is needed. So by the time they go into the third or fourth window there will be 3 to 4 different windows showing up on the task bar which I don't want.
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Mar 22nd, 2011, 10:08 AM
#5
Re: Showing and Hiding a form
Set ShowInTaskBar = False for each of the Owned forms. Then only the top Owner form will appear in the task bar and in Alt-Tab.
But don't make the main form ShowInTaskBar = False too, because although it won't appear in the task bar, all of the forms will then appear in Alt-Tab (MS-Gotcha no. 426 ). BB
-
Mar 22nd, 2011, 10:12 AM
#6
Thread Starter
Fanatic Member
Re: Showing and Hiding a form
Yep, just started playing with that right now. I think this will work, just need to mess with it a little more and then test it. I'll respond back once I get this working.
Thanks for the suggestion and help!!
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
-
Mar 23rd, 2011, 01:01 PM
#7
Thread Starter
Fanatic Member
Re: Showing and Hiding a form
 Originally Posted by boops boops
Set ShowInTaskBar = False for each of the Owned forms. Then only the top Owner form will appear in the task bar and in Alt-Tab.
But don't make the main form ShowInTaskBar = False too, because although it won't appear in the task bar, all of the forms will then appear in Alt-Tab (MS-Gotcha no. 426  ). BB
Yep, your solution did the trick. Thank you so much for all your help!
Just in case anyone else runs into this issue when using Remote Desktop Web Access with Windows Server 2008, here is some more information on what I had to do.
Besides adding ownership to the forms I realized the minimize did not work properly in the child form. It would minimize it but then a blue background would show up even though the parent/owner form was transparent. So I had to also force a minimize on the parent/owner form in the SizeChanged event of the Child Form as shown below.
Code:
'When the child form gets minimized also minimize the Main (Owner)
'form otherwise a blue background is still displayed.
If Me.WindowState = FormWindowState.Minimized Then
objMainMenu.WindowState = FormWindowState.Minimized
End If
I also noticed another problem. On some of my forms, when the user tried to exit it checked to see if anything has not been saved to the database. If so it would display a messagebox asking them if they would like to save before exiting. If the user would click no, it would close out of the form and pull up the main (owner) form. I noticed when this messagebox came up, and after clicking no, it would pull up Internet Explorer (the browser that initially launched the app) instead of the main form. I saw that I had to change the ownership in the messagebox to the main form, even though the child form was the form that called up the messagebox.
Code:
Dim isExit As Boolean
Try
If iGrid.isSaved = False Then
'Pull up the messagebox, but make the owner of the messagebox the main form which
'is the owner of this form. If this is not done and Internet Explorer is the first
'screen in the background, it'll pull it to the front instead of displaying the main
'form once the user clicks NO.
If MessageBox.Show(Me.Owner, "Are you sure you want to Exit without Saving?", "ASR", MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.No Then
isExit = False
Else
isExit = True
End If
Else
isExit = True
End If
If isExit Then
objMainMenu.SuspendLayout()
objMainMenu.Opacity = 100
objInvoiceMaintenance.Dispose()
objInvoiceMaintenance = Nothing
objMainMenu.ResumeLayout()
End If
Catch ex As Exception
ErrorTrap(ex, Me.Name, "cmdExit_Click", strErr, Erl)
End Try
Motto: Anything for a laugh.
Getting second place only means you are the first loser to cross the finish line.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|