Adding New Form to Project - Windows Form Application C using Macbook

0 votes

Background information on what I already got: I'm working on a product called RunTotal. I have one form called Form1 in the project, which comprises textboxes, labels, and one button.

What I'm trying to achieve is for this new form to open when the user clicks the button inside Form1.

I have my MacBook partitioned so I can run both Windows and MacOS. I'm not sure if it's because of the partition, but I'm having difficulties adding another Windows Form Application to my project in Visual Studio.

So here are my inquiries:

  1. Is there a specific type of form I require because I came across something concerning inheritance while doing research? Do I need a special type since I'm trying to open this new form when a button on the one I already have is pressed?
  2. How do you create a new form because I can't find a new Windows Form Application anyplace when I try to add a new file
Jun 11, 2022 in C# by pranav
• 2,590 points
5,001 views

1 answer to this question.

0 votes

To add a new form to your application, you don't need to create a new Windows Form Application. Typically, your application's default form is Form1.

enter image description here

Then right click and do this

enter image description here

Now, add form by selecting Windows Form

enter image description here

Set the event for the button in Form1 to something like this

    private void button1_Click(object sender, EventArgs e)
    {

        var form2 = new Form2();
        form2.Show();

    }

If you want to interact with both forms, use form2.Show(); otherwise, use form2. ShowDialog() is used to stall the caller form until it is closed. 

answered Jun 13, 2022 by krishna
• 2,820 points

Related Questions In C#

0 votes
1 answer

Windows Form application on Visual Studio Code?

There is a simpler way to achieve ...READ MORE

answered Jun 7, 2022 in C# by pranav
• 2,590 points
9,755 views
0 votes
0 answers

How Convert VB Project to C#

I have a VB project that has ...READ MORE

Jun 11, 2022 in C# by jyoti
• 1,240 points
1,043 views
0 votes
0 answers

How to add a gridview to a C# winforms project with a list of objects as the datasource

In Visual Studio 2015 community, I'm creating ...READ MORE

Jun 11, 2022 in C# by krishna
• 2,820 points