简体   繁体   中英

ShowDialog() Not showing the form on top of the main form

I have a winforms application that handle's subscription data. The main form checks if the user is in the datastore(xml file) if not i call this. UserDetails is a data entry form.

else
{
    Form frm = new UserDetails();
    frm.ShowDialog();
}

The Problem is the UserDetail form is not on top and I can select the main form.

This may happen if your main form is TopMost .

Try using

frm.ShowDialog(this);

when called from the main form.

This will ensure that the dialog is a visual child of the main form, and even if the main form is TopMost , the dialog will be above it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM