CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2002
    Location
    turkey
    Posts
    50

    please try it...see what happens...is it a bug?

    hi,
    i have a problem with modeless forms...
    When i click a button and execute the code below it works...
    onclickButton()
    {
    ..
    FormX MyForm=new FormX();
    MyForm.Show(); // it creates a modeless form as expected!..
    ..
    }

    but when i call these two lines of code in another function such as a CallBack function like OnReceiveAsync() in my Client program or in a timer delegate function like Timer_Elapsed() it doesn't works...

    it tries to create MyForm but it does not properly appears and it locks the whole program..

    is it a bug? or should i do something else for Modeless forms & dialogs..
    Please try it your self and see what happens..

    Modal forms (MyForm.ShowDialog()
    works properly everywhere whether called by clicking on buttons or
    calling via another function
    but why modeless are not?..

    Thanks for ur help...

  2. #2
    Join Date
    Oct 2001
    Location
    Norway
    Posts
    265
    Winforms doesnt work very well with multiple threads. You are required to ensure that all GUI operations happen on the same thread the main window was created on. To do this, look into the Control.Invoke method.

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

Featured