Click here to Skip to main content
15,902,492 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello
How to place a MessageBox and a FileDialogBox inside my mainForm

I have tried the code below with the properies
C#
TopMost = true,
StartPosition = FormStartPosition.CenterParent
but without success.
Thanks
Bernard

What I have tried:

C#
DialogResult res = new DialogResult();
            res = MessageBox.Show(new Form()
            {
                TopMost = true,
                StartPosition = FormStartPosition.CenterParent
            },
                "Choisissez le fichier GeoDB.",
                "Choix du fichier source",
                MessageBoxButtons.YesNoCancel,
                MessageBoxIcon.Question);

            if (res == DialogResult.Cancel || res == DialogResult.No)
                return;

            OpenFileDialog OFD = new OpenFileDialog();
            OFD.Filter = "Fichier Source GeoDB (*.gdb) | *.gdb";
            OFD.Title = "Choix d'un fichier source GeoDB";

            if (OFD.ShowDialog(new Form()
            {
                TopMost = true,
                StartPosition = FormStartPosition.CenterParent
            }) == DialogResult.OK)
            {
                nomFichierGeoDB = OFD.FileName;
                GeoDBConString = GetGeoDBConString();
            }
Posted
Updated 31-Jul-17 8:22am
v2

1 solution

Here are some examples of using a MessageBox() and OpenFileDialog:
[Dotnetperls-MessageBox]
[OpenFileDialog]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900