Can you please provide an example of how to use the WP& RadMessageBox closedHandler (for buttons)? Something simple like OK and Cancel is fine. The online documentation and sample code do not provide an example.
Thanks,
Sandy
8 Answers, 1 is accepted
Thank you for writing.
Here is an example of how to use the closedHandler argument of RadMessageBox.Show().
RadMessageBox.Show(
"Messagebox Title"
, MessageBoxButtons.OKCancel,
"Messagebox Message"
, closedHandler: (args) =>
{
if
(args.Result == DialogResult.OK)
{
}
else
{
}
});
Please keep in mind that RadMessageBox does not stop execution of the code. Once the method is called RadMessageBox is shown and the Show method immediately returns. The lambda expression will be executed at a later time when one of the message box buttons are pressed.
We will update the online documentation with this example.
Please write again if you have other questions. Greetings,
Victor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
Of course, here is the same snippet in VB:
RadMessageBox.Show(
"Messagebox Title"
, MessageBoxButtons.OKCancel,
"Messagebox message"
, closedHandler:=
Function
(args)
If
args.Result = DialogResult.OK
Then
Else
End
If
End
Function
)
Victor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
You can specify custom content for the buttons by using a different overload of the Show method:
RadMessageBox.Show(
New
String
() {
"OK"
,
"Email"
},
"Messagebox Title"
,
"Messagebox message"
, closedHandler:=
Function
(args)
If
args.Result = DialogResult.OK
Then
Else
End
If
End
Function
)
Please have a look at our online documentation, there you will see all available overloads of the Show method. They are in C# but you will still be able to determine which one you need to use and invoke it from VB. Greetings,
Victor
the Telerik team
Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>
it's an old post but can you complete it to avoid a re-post ...
How can I stop the process until the user has clic on either a button or the other ? if I use the following code :
private void button2_Click(object sender, RoutedEventArgs e)
{
RadInputPrompt.Show("Messagebox Title", MessageBoxButtons.OKCancel, "Messagebox Message", closedHandler: (args) =>
{
if (args.Result == DialogResult.OK)
{
MessageBox.Show("OK");
}
else
{
MessageBox.Show("Cancel");
}
});
MessageBox.Show("Finished !");
}
the MessageBox is showed BEFORE the dialog with the InputPrompt appear !; I just want the input shows first, the user fills it, [ok] or [cancel] is displayed and THEN [finished], how can I achieved this ?
a full source code would be wonderfull.
thanks in advance,
Domi.
Hi Dominique,
Thanks for writing.
You should either rely on the ClosedHandler and put the Finished message box there or use the ShowAsync API and await it. The code execution after the awaited method will happen as soon as you close the input prompt.
Regards,
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>