|
-
July 10th, 2012, 05:04 AM
#1
Unable to open new form
Hi,
I have been programming in Java for a few years and am now trying to teach myself C#. I am using Visual Studio 2010 as my IDE.
I have created a basic form called AddVideo, and I have a separate file called Program.cs
I want Program.cs to display an instance of the AddVideo form.
So far I have tried to do:
Code:
AddVideo form = new AddVideo();
But when I run Program.cs, it displays the program for less than a second and then exits.
How can I fix this?
Thanks
-
July 10th, 2012, 03:10 PM
#2
Re: Unable to open new form
Try
Code:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new AddVideo());
}
}
-
July 11th, 2012, 01:26 AM
#3
Re: Unable to open new form
An IDE could help you avoid this sort of syntactical forgetfulness. I strongly recommend SharpDevelop since it is free, open-source.
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
-
July 11th, 2012, 10:34 AM
#4
Re: Unable to open new form
 Originally Posted by curt_c
Try
Code:
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new AddVideo());
}
}
Thanks :-)
-
July 11th, 2012, 10:35 AM
#5
Re: Unable to open new form
 Originally Posted by BioPhysEngr
An IDE could help you avoid this sort of syntactical forgetfulness. I strongly recommend SharpDevelop since it is free, open-source.
I am using an IDE, Visual Studio 2010.
-
July 11th, 2012, 10:20 PM
#6
Re: Unable to open new form
Oh, well then use it to generate a WinForms project. :-)
Best Regards,
BioPhysEngr
http://blog.biophysengr.net
--
All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|