Showing results for 
Search instead for 
Did you mean: 

B1 2007A , Visual Studio 2005 C# SAP hangs when I use Form.Show();

Former Member
0 Kudos

B1 2007A , Visual Studio 2005 C#

trying to display a C# window ( non SAP) , when a SAP menu is clicked.

SAP hangs when I use Form.Show();

But does not when I use ShowDialog();

can anyone explain why???

Thanks very much.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I think it is like the OpenDialogFile or SaveDialogFile, you have to open it in another Thread :

A C# example with SaveFileDialog

using (GetFileNameClass oGetFileName = new GetFileNameClass(eFileDialog.en_SaveFile))
                oGetFileName.Filter = "txt files (*.txt)|*.txt|All files (*.)|.*";
                oGetFileName.InitialDirectory = "c:";

                Thread threadGetFile = new Thread(new ThreadStart(oGetFileName.GetFileName));
                    while (!threadGetFile.IsAlive) ; ///On attend que le thread démarre
                    Thread.Sleep(1);///On attend un peu
                    threadGetFile.Join(); ///On attend qu'il se termine

                    ///On teste le fichier
                    if (oGetFileName.FileName != string.Empty)
                        nomfichier = oGetFileName.FileName;
                    threadGetFile.Abort();///On arrete le thread

Edited by: Pierre Pettera on Jun 6, 2008 9:47 AM

Answers (0)