C# MessageBox with Time Out

December 23, 2010 at 7:47 am Leave a comment

In an application that I am currently working on I need to have a MessageBox display a warning to users, but wanted it to close down after a time delay if the user did not click the OK button.  This is functionality that I had in the Shell.Popup in my VBScript work, so simply reused that functionality.

I did this by adding a reference to the IWshRuntimeLibrary by selecting Add reference and from the COM tab, selecting the Windows Script Host Object Model.

Then in my code simply put:

IWshRuntimeLibrary.WshShellClass wshShell = new IWshRuntimeLibrary.WshShellClass();

wshShell.Popup(“The Master version has shut down, so this instance needs to close as well.”, 10, “Master Instance of GhostCaster has closed”);

 

Advertisements

Entry filed under: Uncategorized. Tags: , , , .

PowerShell_ISE utility function to add help tags Warming up a SharePoint 2010 Server with PowerShell

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Trackback this post  |  Subscribe to the comments via RSS Feed


Calendar

December 2010
M T W T F S S
« Sep   Feb »
 12345
6789101112
13141516171819
20212223242526
2728293031  

Most Recent Posts


%d bloggers like this: