Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Thread and ShowDialog

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Fatih - 24 Nov 2004 12:37 GMT
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
Herfried K. Wagner [MVP] - 24 Nov 2004 14:25 GMT
"Fatih" <Fatih@discussions.microsoft.com> schrieb:
>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.

Always show your forms in your app's main thread...

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/frlrfSystemWindowsFormsContro
lClassInvokeTopic.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>

Signature

M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://dotnet.mvps.org/dotnet/faqs/

Fatih - 24 Nov 2004 15:27 GMT
Thanks sir but is there any way to open the progress window as modal. (with
ShowDialog method)

> I have a problem about threading when using ShowDialog method.
>
[quoted text clipped - 31 lines]
>
> Thanks
Anthony H - 09 Dec 2004 02:30 GMT
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
Ed Kaim - 13 Dec 2004 15:03 GMT
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/vbco
nprogressbarcontroloverview.asp
.

> 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
[quoted text clipped - 4 lines]
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.