Results 1 to 4 of 4

Thread: showdialog

  1. #1

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256

    showdialog

    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

    VB Code:
    1. HForm.ShowDialog()
    2. System.Windows.Forms.Application.DoEvents()

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

    VB Code:
    1. HForm.Hide()
    2. System.Windows.Forms.Application.DoEvents()
    3. TravelForm.ShowDialog()
    4. 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...

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    it might be the doevents

    why are you using them anyway?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256
    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..

    VB Code:
    1. HForm.Hide()
    2. HForm.TopMost = False
    3. System.Windows.Forms.Application.DoEvents()
    4. TravelForm.ShowDialog()
    5. TravelForm.TopMost = True
    6. System.Windows.Forms.Application.DoEvents()

    thanks,

    jeff

  4. #4

    Thread Starter
    Registered User jkw119's Avatar
    Join Date
    Oct 2001
    Location
    Pittsburgh
    Posts
    256
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width