I have form1(frmGate) and form2 (frmEdit)
form1 minimizes when form2 is open and restores when form2 is closed
however I use this to open form2
private void btnEdit_Click(object sender, EventArgs e)
{
//checks to see if the form is open
if (editor == null || editor.IsDisposed == true)
{
editor = new frmEdit();
editor.InstanceRef = this;
}
// Loads edit windows for selected Dealer
editor.dealerBindingSource.DataSource = this.dealerBindingSource;
editor.dealerBindingSource.CurrencyManager.Position = Convert.ToInt32(dealerBindingNavigator.PositionItem.Text);
this.WindowState = FormWindowState.Minimized;
editor.Show();
}
but frmEdit does not come to front
it is on desktop not minmized but comes up behind browser and such...
tried to add frmEdit _Shown event
private void frmEdit_Shown(object sender, EventArgs e)
{
//Make form active
this.Activate();
this.BringToFront();
}
and
private void frmEdit_Shown(object sender, EventArgs e)
{
//Make form active
this.TopMost = true;
this.Focus();
this.BringToFront();
this.TopMost = false;
}
and still it wont come to front...
I set frmEdit TopMost property to true in designer and removed the top line in code above but then it will not set the topmost to false and is always on top...
I even tried the above code in the frmEdit_Load event and no joy
Cant seem to understand why this is happening
Any help would be much appreciated