Skip to Content
0
Former Member
May 31, 2008 at 07:01 PM

Applicaiton form hangs when trying to make C# form visible from menu event

255 Views

I have a MDI windows app, running as an addon on Verion 2007A

The applicaion is written in C# ( VS 2005)

I am a newbee to C# ( VS too ) as well.

All I want is to display the MDI container form when a menu is clicked. But the windows form hangs forever, and does not show.

if I try to show the form within Main method then no issues! The problem happens only off the SBO menu event .

I cannot have the form loaded all the time. so I need the services of the SBO menu click, so a user can open it whenever he wants.

Note: I can open any other form off the menu click, but that , provided they are not MDI containers and they are opened with ShowDialog(); If I use Show(); then again hangs.

I tried opening the MDI form in Main method, ( wich of course works) and hide it when not needed. I could hide the form, but when I issued a command myForm.visible = true; through the SBO menu event, again hangs!

my applicaion Main function is as follows. The class AA_SBO_MAIN holds the SBO application events.

static void Main()

{

Application.EnableVisualStyles();

Application.SetCompatibleTextRenderingDefault(false);

Classes.AA_SBO_MAIN oSBOMain = null;

oSBOMain = new Classes.AA_SBO_MAIN();

Application.Run();

}

the menu event simply does

frmMain fm = new frmMain();

fm.Visible = true;