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
3,816 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
8,331 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
739 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
1,197 views
0 votes
1 answer

What is the best C# to VB.net converter

Telerik has a solid SharpDevelop-based converter that ...READ MORE

answered May 30, 2022 in C# by rajiv
• 1,620 points
1,604 views
0 votes
1 answer

How to install C#

Hi @Akanksha, C# is a programming language ...READ MORE

answered Feb 28, 2019 in Others by Pratibha
• 3,690 points
1,137 views
0 votes
1 answer

How to run C# code on Ubuntu

Hey @Abha, you can create and run ...READ MORE

answered Mar 1, 2019 in Others by Anvi
• 14,150 points
6,518 views
+1 vote
2 answers

RPA C# - Process developments in C #

Hey Conell, you can use Visual Studio's ...READ MORE

answered May 24, 2019 in RPA by Abha
• 28,140 points
2,506 views
0 votes
1 answer
0 votes
1 answer

How to convert JSON text into objects using C#

To make a class out of a ...READ MORE

answered Jun 13, 2022 in C# by krishna
• 2,820 points
569 views
0 votes
1 answer

How to practice a language like C#

I believe you should begin with personal ...READ MORE

answered Jun 13, 2022 in C# by krishna
• 2,820 points
654 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP