Reputation: 572
I am launching a C# made form from VBA code inside an Excel workbook.
I'd like this form to appear on top of all other windows/Applications including the Excel workbook.
I'd tried combinations of
Form1 f = new Form1();
f.Focus();
f.ShowDialog();
f.Activate();
f.Show();
But none of them seems to work. Any hints?
Many thanks
JB
Upvotes: 5
Views: 8867
Reputation: 572
I found a tricky way of doing it: I maximized and then turned back to normal:
Form1 f = new Form1();
f.WindowState = FormWindowState.Maximized;
f.Focus();
f.Show();
f.WindowState = FormWindowState.Normal;
Application.Run(f);
Upvotes: 3