Reputation: 2640
I've read up on this and I'm ready to punt at this point.
I'm working on a C# project in VS2010. Within the solution I'm working with, I have two class files/ dll's, and a windows forms project called "TradingApp". The forms project has one form, a main form. There is also a form in one of the class files. I want the main form in TradingApp to be the startup form. I have set the startup project in the solution to my app, and have set the TradingApp startup object to "TradingApp.Program." I also call my form by name as so: Application.Run(new frmTradingAppMain());
from Main(). (I didn't see my form name as an option). When I run the program, it appears that a blank version of the other form in my class library is loading.
I'm at my wits end, and your mercy. Thanks in advance...
Kevin
Here's main as requested:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new frmTradingAppMain());
}
Update: Of course it had to be something on the nose... I (somehow) was missing:
public frmTradingAppMain()
{
InitializeComponent();
}
Thanks again for the help.
Upvotes: 0
Views: 17282
Reputation:
Please go to Program.cs
and change the form name in Application.run()
to the name which you want to be the startup.
For example:
Application.Run(new MyForm());
Upvotes: 3
Reputation: 756
(I didn't see my form name as an option)
From this statement, I have to wonder if you are including or calling your form with the correct namespace for it. It sounds to me like Main() is in a different namespace than the form (frmTradingAppMain) that you are wanting to show. Check the frmTradingAppMain cs file for the namespace and try adding that before the formname.
So for example, if your form is in the namespace TradingApp, the frmTradingAppMain.cs file might start something like this:
namespace TradingApp
{
public partial class frmTradingAppMain
{
...
}
}
So then from main, you would try to start it like this:
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new TradingApp.frmTradingAppMain());
}
Upvotes: 1