Our users noticed today that RadMessageBox throws an error if additional calls to Show are made while the original dialog is still open. Our application uses BackgroundWorker, so processes alerting the user to their completion is a normal activity. This can result in multiple modal dialogs showing up all at the same time, which is acceptable.
Until recently, we used the built-in WinForm MessageBox. We switched over to get the common look and feel. However, now we are getting this error: Form that is already visible cannot be displayed as a modal dialog box. Set the form's visible property to false before calling showDialog.
We don't want to go back to the ugly MessageBoxes, so it would be nice if there was a way for RadMessageBox to overcome this problem.
13 Answers, 1 is accepted
A coworker and I also tried explicitly locking on the type of the RadMessageBox, like so:
However, it would appear that there are some odd things happening with the chosen sync object. If we lock on a separate sync object or on a different type, everything works as expected.
For now, we are explicitly locking on a different sync object.
I haven't been able to replicate your issue. Please can you post a sample showing how to replicate this and I will do my best to see if I can replicate it and post a workaround for you.
Could you also confirm confirm the version of the RadControls that you are using?
Here is a link to the BackgroundWorker documentation that explains why this code should work. http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx You can even see in their examples that the RunWorkCompleted event should be able to interact with the UI.
I can replicate your issue using the RadMessageBox
Message=A circular control reference has been made. A control cannot be owned by or parented to itself.
where this doesn't occur with a standard messagebox. At the moment, I cannot offer you a workaround, but if I can find one for you, I'll let you know.
Our RadMessageBox is designed in such a way that only one message box could be shown in any moment since our controls are not thread-safe and are intended to work in single-thread scenarios.
A simple workaround is to create your own message box form with a label and a button and show it using the ShowDialog method. You should use a RadForm in order to achieve the common look and feel.
Since your scenario is a common one, we will consider supporting it in a future version. Your Telerik points have been updated.
Hope this was helpful. If you have any further questions or you need further assistance, feel free write back.
All the best,
the Telerik team
Is there any update on this?
Is there any update on this?
A circular control reference has been made. A control cannot be owned by or parented to itself.
This only happens in certain places in my app, and I'm trying to figure out why it occurs on some dialogs but not others. I've also noticed that changing the call from :
RadMessageBox.Show(this, "My Text");
resolves the issue...though I'm not sure why. I've also verified that the error doesn't occur in the previous version of the controls.
Thank you for writing.
In Q1 2013 we changed core functionality in RadMessageBox. Before the change, RadMessageBox was disposing after each usage, now the instance is not disposed and it is reused to show all messages (singleton). This change in the behavior of the control lead to several issues and most of them we already resolved.
We were aware about this issue and we already have a related pits item http://www.telerik.com/support/pits.aspx#/public/winforms/14649. This issue appears when your Form hasits TopMost property set to true and RadMessageBox does not have owner. To workaround this issue you have several ways:
1. Set TopMost property of your form to false.
2. Set the owner of the RadMessageBox (as you already found out).
3. Dispose the instance of RadMessageBox after every usage.
I hope this helps and please excuse us for the introduced inconvenience.
We have the same issue as Travis explained exactly in his post.
We are working with a BackgroundWorker and this one sometimes shows a RadMessageBox.
The problem is that the RadMessageBox is not showed as modal and sometimes is not showed in front.
Do you know how to fix it?, we cannot use the parameter this (the winform) when we are calling the RadMessageBox because is created by another process, not by the BackgroundWorker.
Thanks and regards,
private static BackgroundWorker createBackgroundWorker(int seconds)
BackgroundWorker worker1 = new BackgroundWorker();
worker1.DoWork += (sender, e) =>
worker1.RunWorkerCompleted += (sender, e) =>
RadMessageBox.Show("Completed"); ------> as commented if we try with RadMessageBox.Show(this, "Completed"); the application fails because 'this' is not understood by the BackgroundWorker
Following the provided information, I have prepared a sample project to test the behavior on my end with the latest version (2021.1.223) of the Telerik UI for WinForms suite. Please refer to the attached gif file illustrating the behavior on my end with the specified version. I have attached my sample project. Am I missing something? Could you please specify the exact steps how to reproduce the problem?
Alternatively, you can submit a support ticket from your Telerik account and provide a sample runnable project demonstrating the problem you are facing. Thus, we would be able to reproduce the experienced issue and investigate the precise case. Thank you in advance.
I am looking forward to your reply.
Dess | Tech Support Engineer, Sr.
Тhe web is about to get a bit better!
The Progress Hack-For-Good Challenge has started. Learn how to enter and make the web a worthier place: https://progress-worthyweb.devpost.com.