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