PDA

Click to See Complete Forum and Search --> : showdialog


jkw119
Jun 12th, 2002, 01:00 PM
I am having trouble with the showdialog. I have a Main form, when you hit the button, it then loads a form by this method

HForm.ShowDialog()
System.Windows.Forms.Application.DoEvents()

but, then i have a next button on the Hform which does the following:

HForm.Hide()
System.Windows.Forms.Application.DoEvents()
TravelForm.ShowDialog()
System.Windows.Forms.Application.DoEvents()

now, the travelform is not becoming modal over the mainform...

does anyone have an idea of what might be wrong? thanks...

Cander
Jun 12th, 2002, 01:16 PM
it might be the doevents

why are you using them anyway?

jkw119
Jun 12th, 2002, 01:36 PM
actually, the problem is a little weird, because, when the HForm displays over the mainform, with the first showdialog event, it is modal in that when you minimize, both forms minimize, but, when you HForm.hide, then do a travelform.showdialog, i think that statment is putting the modal form over the hidden form of hform. the following code seemed to have fixed the problem..

HForm.Hide()
HForm.TopMost = False
System.Windows.Forms.Application.DoEvents()
TravelForm.ShowDialog()
TravelForm.TopMost = True
System.Windows.Forms.Application.DoEvents()

thanks,

jeff

jkw119
Jun 12th, 2002, 01:40 PM
in response to the doEvents, i use them because with each input, it effects what is displayed on the next form. so in the load subroutine, of the next form, i have to enable things, disable things, based on the previous events. if you don't use a doevents, after the showdialog, the program attempts to show the form before it is completely loaded. it looks alot better when you have the doevents.