Although I actually think that having main() in its own class is a good idea
(and, apparently, so does Microsoft, as this is the default way a lot of
things are created in Whidbey) I don't think it is a *necessary* change to
make this type of application happen. The normal restrictions on main()
wo
Hmm.
I've emailed you a zip of what I am doing offline -- I'm not getting that
behaviour, and I'm hoping we can see the difference if we are both looking at
the same thing.
-- Rick
ps. i probably won't be able to give this much attention from now until
tomorrow morning (+13 hrs, ~8 am CST). I
Still doesn't work for me. Here's my code - I think it's the same as what
you're proposing:
if (args.Length == 0) {
Application.Run(new MForm());
} else {
Console.OpenStandardOutput();
Console.WriteLine("Hello there");
Console.ReadLine();
}
Changed the output type
To outline, for those who would like to create an application that
supports console and WinForms in the most straight-foward way:
Create a console application.
Create a form class (Select meny Project/Add Windows Form...)
Where you want the form to be displayed add code similar to the following:
I changed the output type to be a windows app and did this for the main method
and it seemed to work
static void Main(string[] args)
{
if (args.Length>0)
{
Application.Run(new MixedAppTest.TestForm());
}
else
{
Console.OpenStandardOutput();
Console.WriteLine("Hello there");
Console.ReadLine();
}
Rick,
How do you manage to get this result is beyond me.
When I use the exact same code (and that approach was my first thought
anyway), I get both a new console window _and_ a form. Don't want the
console window to open up though :) - only if I intend to have _no_ UI at
all.
-Original Mess
I may not be understanding exactly what you are after, but, as a test, I
created a new console app in the IDE. To that, I added a reference to
System.Windows.Forms.dll. From there, I created a new form named TestForm, and
added some controls to it. From there, I altered my main method to look li
I think the typical way to do this is with staged executables.
devenv (the command line utility for the Visual Studio IDE) is actually two
executables. When you type devenv on the command line, you're actually
running the command line version, which will spawn the true Windows app as
necessary.
Hello everybody,
I am not quite sure if this - or WinForms - is the proper forum for this
question. Decided to try ADVANCED-DOTNET first because I love the quality
of people here so much :)
I have a WinForms app. When started directly (without cmd line parameters),
I want it to be a regular app