|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
disabling MdiParent during load causes incorrect MdiChild to be acan error... I have an MDI application that loads a few MDI Children on startup. While it initially loads, I want to prevent the user from being able to click in it, so I have set MdiParent.Enabled = False at the beginning of the Form_Load event handler. I change it back to true at the end of the event handler. While MdiParent.Enabled = False, I open my MdiChild forms. Normally, the last MdiChild that is opened is the Active child form. But, when I re-enable MdiParent, it changes the active child form to the first MdiChild that was created. Here's the sample code. Private Sub MdiParent_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.Enabled = False Dim child As MdiChild For i As Integer = 1 To 5 child = New MdiChild() child.Text = "Form " & i child.MdiParent = Me child.Show() Next i Me.Enabled = True End Sub This results in Form 1 being the active form, when I would expect Form 5 to be active. If I comment out the code that disables/enables MdiParent, then Form 5 is the active form. Should this work this way or is it a bug? Should I be using some other way of preventing the user from clicking in the app during load? I can create my own variable to keep track of the most recently added form. I was just curious if there was a better way to do this. Also, I tried using MdiParent.ActiveMdiChild, but it is Nothing before MdiParent gets reenabled. Thanks, ~Karen Karen wrote:
> Should this work this way or is it a bug? Should I be using some I can repro the behavior but it doesn't matter because Load occurs before > other way of preventing the user from clicking in the app during load? the Form gets visible. Consequently, during load, there is nothing to click into. Therefore, disabling during load does not make sense. Armin
save treeview state and call from another form
is it save to call functions from another form? Bracketed types Help with Event handler, withevents, raise events Bitmap from a file windows.forms.controls System icons in Listview VS2010 for database developers How to catch page redirect ISAM not found |
|||||||||||||||||||||||