0

(.net 3.5 compact) I have a form which is hidden(b) . When I open my new form(a), i want to display this hidden form(b) that is hidden.

If i create a button on form(a) and on the click event i do a .Show() , it works fine .

if i add the ff to the load event , the forms does not come to the front and stays hidden.Also tried adding it after InitializeComponent(); but the form does not come to the front.

        reg.frmScanner.Show();

I have read the minimize trick here , but there is no minimize on mobile device

1
  • 1
    Try the BringToFront() method. Do beware that this is a strong hint that the form was created on a worker thread. Also matches the usage, a "scanner" tends to generate events on a background thread. That is not healthy, be sure to use BeginInvoke() so all UI is created on the main thread. Mar 21, 2015 at 10:26

2 Answers 2

2

To get it to be in the foreground use

reg.frmScanner.TopMost = true;
1
  • Thanks , works like a charm, i do form.show and the form.TopMost as you suggested and it works !
    – Zaid Kajee
    Mar 21, 2015 at 20:55
0

You need to create an instance of form reg.frmScanner. Hide it using reg.frmScanner.Hide()when needed. Show it using reg.frmScanner.Show(). You will not get desired show/hide results if you use direct calling the form without creating an instance of it.

1
  • I am creating an instance , thats not the problem, form is there , just in the background, need to be in the foreground on another forms load
    – Zaid Kajee
    Mar 21, 2015 at 8:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.