|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Thread and ShowDialogI have 2 forms and first one opens second one as modal. Form2 (second form) has a progress bar. Any suggesstion. Thanks. HEre is my code... private void Form1_Load(object sender, System.EventArgs e) { Thread t = new Thread(new ThreadStart(test)); t.Start(); this.label1.Text = "12 3214 "; } private void test() { Form2 d = new Form2(); d.TopMost = true; d.ShowDialog(); } // Form2 code.... private void Form2_Load(object sender, System.EventArgs e) { for(int i = 0 ; i < 100 ; i++) { this.progressBar1.Value = i; Thread.Sleep(50); } } Thanks "Fatih" <Fa***@discussions.microsoft.com> schrieb: Always show your forms in your app's main thread...>I have a problem about threading when using ShowDialog method. > > I have 2 forms and first one opens second one as modal. Form2 (second > form) > has a progress bar. Any suggesstion. A .NET Progress Dialog <URL:http://www.codeproject.com/cs/miscctrl/progressdialog.asp> Multithreading + Windows Forms: <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp> <URL:http://www.devx.com/dotnet/Article/11358/> <URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsControlClassInvokeTopic.asp> Multithreading in Visual Basic .NET (Visual Basic Language Concepts) <URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconthreadinginvisualbasic.asp> Sample: <URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip> -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://dotnet.mvps.org/dotnet/faqs/> Thanks sir but is there any way to open the progress window as modal. (with
ShowDialog method) Show quote "Fatih" wrote: > I have a problem about threading when using ShowDialog method. > > I have 2 forms and first one opens second one as modal. Form2 (second form) > has a progress bar. Any suggesstion. > > Thanks. > > HEre is my code... > > private void Form1_Load(object sender, System.EventArgs e) > { > Thread t = new Thread(new ThreadStart(test)); > t.Start(); > this.label1.Text = "12 3214 "; > } > > private void test() > { > Form2 d = new Form2(); > d.TopMost = true; > d.ShowDialog(); > } > > // Form2 code.... > > private void Form2_Load(object sender, System.EventArgs e) > { > for(int i = 0 ; i < 100 ; i++) > { > this.progressBar1.Value = i; > Thread.Sleep(50); > } > } > > > Thanks Considering how ubiquitous the need for progress dialogs is -- and how
complex it is to program them -- why hasn't any of the component vendors added it to their suites? I would *totally* pay money for one! handa29 *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! You can write a progress dialog in about 3 minutes. Check out ProgressBar:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbconprogressbarcontroloverview.asp. Show quote "Anthony H" <hand***@hotmail.com> wrote in message news:e7U0GcZ3EHA.2288@TK2MSFTNGP11.phx.gbl... > Considering how ubiquitous the need for progress dialogs is -- and how > complex it is to program them -- why hasn't any of the component vendors > added it to their suites? I would *totally* pay money for one! > > handa29 > > > > *** Sent via Developersdex http://www.developersdex.com *** > Don't just participate in USENET...get rewarded for it! |
|||||||||||||||||||||||