ShowDialog not opening form Visual Studio












-3















when i try to open a form on visual studio, it doesn't work. i've tried many solutions but it still doesn't work, could the problem be in a different code? here is the code that i am using:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VBR_Application
{
public partial class addNewGT : Form
{
public addNewGT()
{
InitializeComponent();
}

private void addOnline_Click(object sender, EventArgs e)
{
var newForm = new AddOnline();
newForm.Show();
}
}
}









share|improve this question




















  • 2





    You aren't calling ShowDialog.

    – mjwills
    Nov 21 '18 at 8:53






  • 5





    Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

    – mjwills
    Nov 21 '18 at 8:54
















-3















when i try to open a form on visual studio, it doesn't work. i've tried many solutions but it still doesn't work, could the problem be in a different code? here is the code that i am using:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VBR_Application
{
public partial class addNewGT : Form
{
public addNewGT()
{
InitializeComponent();
}

private void addOnline_Click(object sender, EventArgs e)
{
var newForm = new AddOnline();
newForm.Show();
}
}
}









share|improve this question




















  • 2





    You aren't calling ShowDialog.

    – mjwills
    Nov 21 '18 at 8:53






  • 5





    Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

    – mjwills
    Nov 21 '18 at 8:54














-3












-3








-3








when i try to open a form on visual studio, it doesn't work. i've tried many solutions but it still doesn't work, could the problem be in a different code? here is the code that i am using:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VBR_Application
{
public partial class addNewGT : Form
{
public addNewGT()
{
InitializeComponent();
}

private void addOnline_Click(object sender, EventArgs e)
{
var newForm = new AddOnline();
newForm.Show();
}
}
}









share|improve this question
















when i try to open a form on visual studio, it doesn't work. i've tried many solutions but it still doesn't work, could the problem be in a different code? here is the code that i am using:



using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace VBR_Application
{
public partial class addNewGT : Form
{
public addNewGT()
{
InitializeComponent();
}

private void addOnline_Click(object sender, EventArgs e)
{
var newForm = new AddOnline();
newForm.Show();
}
}
}






c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '18 at 13:43









Lennart

6,122125166




6,122125166










asked Nov 21 '18 at 8:52









V. ProjectsV. Projects

1




1








  • 2





    You aren't calling ShowDialog.

    – mjwills
    Nov 21 '18 at 8:53






  • 5





    Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

    – mjwills
    Nov 21 '18 at 8:54














  • 2





    You aren't calling ShowDialog.

    – mjwills
    Nov 21 '18 at 8:53






  • 5





    Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

    – mjwills
    Nov 21 '18 at 8:54








2




2





You aren't calling ShowDialog.

– mjwills
Nov 21 '18 at 8:53





You aren't calling ShowDialog.

– mjwills
Nov 21 '18 at 8:53




5




5





Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

– mjwills
Nov 21 '18 at 8:54





Please put a breakpoint on var newForm = new AddOnline();. Run the code. click the button. Does the breakpoint get hit?

– mjwills
Nov 21 '18 at 8:54












2 Answers
2






active

oldest

votes


















0














Did you mean?



private void addOnline_Click(object sender, EventArgs e)
{
var newForm = new Form();
newForm.Show();

}





share|improve this answer
























  • Almost certainly not. Form is the base class for all forms, it's not a specific form

    – Panagiotis Kanavos
    Nov 21 '18 at 9:37











  • I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

    – user10684840
    Nov 21 '18 at 9:51





















0














If you want show a built in dialog you can use this one



 MessageBox.Show(this, "Title", "Message");


If you want a custom dialog you can also use this one



_FormDialog dialog = new _FormDialog(this);
dialog.ShowDialog();


_FormDialog is the widows form you have created.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408294%2fshowdialog-not-opening-form-visual-studio%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    Did you mean?



    private void addOnline_Click(object sender, EventArgs e)
    {
    var newForm = new Form();
    newForm.Show();

    }





    share|improve this answer
























    • Almost certainly not. Form is the base class for all forms, it's not a specific form

      – Panagiotis Kanavos
      Nov 21 '18 at 9:37











    • I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

      – user10684840
      Nov 21 '18 at 9:51


















    0














    Did you mean?



    private void addOnline_Click(object sender, EventArgs e)
    {
    var newForm = new Form();
    newForm.Show();

    }





    share|improve this answer
























    • Almost certainly not. Form is the base class for all forms, it's not a specific form

      – Panagiotis Kanavos
      Nov 21 '18 at 9:37











    • I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

      – user10684840
      Nov 21 '18 at 9:51
















    0












    0








    0







    Did you mean?



    private void addOnline_Click(object sender, EventArgs e)
    {
    var newForm = new Form();
    newForm.Show();

    }





    share|improve this answer













    Did you mean?



    private void addOnline_Click(object sender, EventArgs e)
    {
    var newForm = new Form();
    newForm.Show();

    }






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 21 '18 at 9:25







    user10684840




















    • Almost certainly not. Form is the base class for all forms, it's not a specific form

      – Panagiotis Kanavos
      Nov 21 '18 at 9:37











    • I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

      – user10684840
      Nov 21 '18 at 9:51





















    • Almost certainly not. Form is the base class for all forms, it's not a specific form

      – Panagiotis Kanavos
      Nov 21 '18 at 9:37











    • I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

      – user10684840
      Nov 21 '18 at 9:51



















    Almost certainly not. Form is the base class for all forms, it's not a specific form

    – Panagiotis Kanavos
    Nov 21 '18 at 9:37





    Almost certainly not. Form is the base class for all forms, it's not a specific form

    – Panagiotis Kanavos
    Nov 21 '18 at 9:37













    I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

    – user10684840
    Nov 21 '18 at 9:51







    I know, but did he mean that he just can't open a new form? Or newForm.ShowDialog();

    – user10684840
    Nov 21 '18 at 9:51















    0














    If you want show a built in dialog you can use this one



     MessageBox.Show(this, "Title", "Message");


    If you want a custom dialog you can also use this one



    _FormDialog dialog = new _FormDialog(this);
    dialog.ShowDialog();


    _FormDialog is the widows form you have created.






    share|improve this answer




























      0














      If you want show a built in dialog you can use this one



       MessageBox.Show(this, "Title", "Message");


      If you want a custom dialog you can also use this one



      _FormDialog dialog = new _FormDialog(this);
      dialog.ShowDialog();


      _FormDialog is the widows form you have created.






      share|improve this answer


























        0












        0








        0







        If you want show a built in dialog you can use this one



         MessageBox.Show(this, "Title", "Message");


        If you want a custom dialog you can also use this one



        _FormDialog dialog = new _FormDialog(this);
        dialog.ShowDialog();


        _FormDialog is the widows form you have created.






        share|improve this answer













        If you want show a built in dialog you can use this one



         MessageBox.Show(this, "Title", "Message");


        If you want a custom dialog you can also use this one



        _FormDialog dialog = new _FormDialog(this);
        dialog.ShowDialog();


        _FormDialog is the widows form you have created.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 21 '18 at 9:32









        klitzklitz

        285




        285






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53408294%2fshowdialog-not-opening-form-visual-studio%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            這個網誌中的熱門文章

            Xamarin.form Move up view when keyboard appear

            Post-Redirect-Get with Spring WebFlux and Thymeleaf

            Anylogic : not able to use stopDelay()