I am using the ultraTabbedMdiManager on an MDI form, checking to see if the form is already open and if open, attempting to select that tab programatically. The problem is, it doesn't select the already existing tab/form, it creates another instance of that tab/form. I've tried tab.Active(), tab.Show(), tab.Form.BringToFront and tab.Form.Select and all of these actually create another instance of the already existing tab. Please see code snippet below. Any assistance in solving this would be very much appreciated.
Thanks, Michelle
foreach
.ultraTabbedMdiManager1.ActiveTab.TabGroup.Tabs)
{
//Select tab
//tab.Activate();
tab.Form.Show();
//tab.Form.BringToFront();
//tab.Form.Select();
}
(MdiTab tab in this.ultraTabbedMdiManager1.ActiveTab.TabGroup.Tabs)
if (tab.Form.Name == "RequestForm"
)
if (((RequestForm)tab.Form).TransferRequest.ID == (int)this.QueueDataGridView.Rows[this.QueueDataGridView.SelectedRows[0].Index].Cells["RequestIDTextBoxColumn"
].Value)
//tab.Form.Show();
This post is very old but I had the same problem recent and I solved by the follwoing
Imports System.Linq ' need to add If Application.OpenForms().OfType(Of Form2).Any Then MessageBox.Show("Opened") Else Dim f2 As New Form2 f2.Text = "form2" f2.Show() End IfThe is not my solution. The source link is below:https://stackoverflow.com/questions/15439440/check-if-form-is-opened
Thanks for your response. Please do not hesitate to write us if you have any further questions.
Regards
Hi Georgi, thanks for the reply. We were actually able to get it working. The problem was due to my foreach loop. I was never breaking out of the loop so it would find the existing form and select it but it would also find forms that didn't exist and open a new one, hence the duplicate forms. We ended up using a lambda expression to find the form and that did the trick.
Thanks again!
Hi Mmoritko,
Have you been able to resolve your issue ? Did you have a time to try my suggestion. Let me know if you have any questions.
If I understand your scenario, maybe you could try to set the property:
ultraTabbedMdiManager1.TabGroups[0].TabSettings.TabCloseAction = Infragistics.Win.UltraWinTabbedMdi.MdiTabCloseAction.Hide;
Than you could loop through the hidden tabs and show it again. for example:
foreach (var it in ultraTabbedMdiManager1.HiddenTabs){ it.Show();}
Let me know if you have any questions.