Link to home
Start Free TrialLog in
Avatar of Richard Payne
Richard PayneFlag for Bulgaria

asked on

C#, VS2008, threadpool & window form as custom messagebox

(a) I dislike the messagebox as it has no capability to timeout or close it remotely who open it first place. Many other are complex and make use of low level dll code
(b) I have simple custom message box MsgBox.
(c) I use Show() and Hide() to display MsgBox as necessary.
(d) I used backgroundworker thread and cannot use it because I have one elsewhere.
(e) This leave ThreadPool for do operation similar to backgroundworker.
(f) I have search for example in google and most and not successful in finding one related with window form.

Can anyone send me a link which make use of threadpool that open and close window and various useful task. perfer NET 3.5 modern code.

 
ASKER CERTIFIED SOLUTION
Avatar of Jarrod
Jarrod
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of kaufmed
Have you considered putting your custom form on a Timer that would close the form at some interval?
var
 fmessage 
=
 
new
 
Form
();

            fmessage
.
Width
 
=
 
300
;

            fmessage
.
Height
 
=
 
100
;


            fmessage
.
Text
 
=
 
"Message Title"
;


            fmessage
.
Show
();

            
Thread
.
Sleep
(
2000
);

            fmessage
.
Close
();var fmessage = new Form();
            fmessage.Width = 300;
            fmessage.Height = 100;

            fmessage.Text = "Message Title";

            fmessage.Show();
            Thread.Sleep(2000);

with a call to your custom MsgBox
            fmessage.Close();

Open in new window

Avatar of Richard Payne

ASKER

I notice new "var", is there website link to teach me how and when to use it......fundamental then pro and con.
Why async variable really matter?