I am trying to send the user confirmation of an action, without using MessageBox.Show() because it requires a button to be pressed to take the message off the screen.
I am copying some text for them into the Windows Clipboard, and want to notify them to save time. But I'd rather not use MessageBox.Show().
Asked
Active
Viewed 2,191 times
-2

MrMohr
- 117
- 1
- 6
-
So you´re building a status-bar into your app? This is just a bar within the app itself that does not pop up actually but simply a text within your window that show some status? – MakePeaceGreatAgain May 11 '17 at 14:59
-
build / create a custom winform then – MethodMan May 11 '17 at 15:00
-
Possible duplicate of [Close a MessageBox after several seconds](http://stackoverflow.com/questions/14522540/close-a-messagebox-after-several-seconds) – Master Yoda May 11 '17 at 16:07
1 Answers
2
MessageBox.Show()
simply displays a form with some buttons using ShowDialog()
- You can create your own form, with a timer, and display it using the ShowDialog()
method, start the timer on form load, and set the form's DialogResult
property once the timer has ticked.
I would suggest to set the message as well as the time to display it in the form's constructor:
public TimedMessageBox(string message, int millisecondsToShow)
And in the main form:
var message = new TimedMessageBox("My message", 1000);
message.ShowDialog(this);
Don't forget to set the TimedMessageBox
form StartPosition
property to CenterParent
.

Zohar Peled
- 79,642
- 10
- 69
- 121