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
Set the TopMost property to true
.
f.TopMost = true;
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);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With