Showing a secondary form

J

John Dann

I have a main form and then a secondary form that allows entry of some
settings. I want to show the secondary form modally (I guess using
..ShowDialog), but I'd like it shown against the background of the main
form. At present using frm2.showdialog eg from a main form menu click
causes the main form to disappear from the background, which is a
little disorientating for the user.

Is this the standard behaviour of ShowDialog or have I got a bug (like
a me.hide hidden away somewhere relating to the main form that I need
to hunt down) ?

JGD
 
C

Cor Ligthert

John,

Just set in your dialog form
\\\
frm.owner = me
///

And you should of course make than frm, something smaller otherwise it looks
strange.

The mainform should not disapear when the dialog form is smaller, when it
does, than show us some code you are using.

With the showdialog is as far as I know only a bug with the behaviour of the
standard form buttons and not in this case.

I hope this helps?

Cor
 
G

Greg Burns

Your main form should not be disappearing w/o you having coded it to do so.

Greg
 
J

John Dann

Just set in your dialog form
\\\
frm.owner = me
///

OK thanks. Is there any reason not to say:

frm.showdialog(Me)

(Which I've just discovered with your prompting and which seems to
work equally well)

JGD
 
C

Cor Ligthert

John,

There is in my opinion never a reason not to use something, that is the
poweer of dotnet, there is not a best way, there are maybe ways to avoid.

Just my thought,

Cor
 
H

Herfried K. Wagner [MVP]

John Dann said:
I have a main form and then a secondary form that allows entry of some
settings. I want to show the secondary form modally (I guess using
.ShowDialog), but I'd like it shown against the background of the main
form. At present using frm2.showdialog eg from a main form menu click
causes the main form to disappear from the background, which is a
little disorientating for the user.

Is this the standard behaviour of ShowDialog or have I got a bug (like
a me.hide hidden away somewhere relating to the main form that I need
to hunt down) ?

Normally, showing a form modally does not /hide/ the form it's shown on.
Can you post the code you are using to show the 2nd form?
 
J

John Dann

Normally, showing a form modally does not /hide/ the form it's shown on.

That's what I thought.
Can you post the code you are using to show the 2nd form?

Well I would but it's fairly straightforward and innocuous. But more
to the point, now that I've gone back and taken out the owner
reference as a test, the main form isn't disappearing any more! But
I'd swear it was happening every time before. So something's obviously
changed but it's probably not worth taking anyone's time in
speculating or investigating what it might have been. Just hope it
doesn't happen again!

Thanks everyone anyway.

JGD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top