Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,162 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,909 people online right now. Registration is fast and FREE... Join Now!




Disappearing Form

 
Reply to this topicStart new topic

Disappearing Form

PsychoCoder
12 Dec, 2007 - 12:23 PM
Post #1

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I have a [problem I've never experienced before. I started working on a C# web browser for a tutorial, I have tons tons of work done so far, and when I hi the play button to view my work and see how the functionality works so far, but the form doesn't show. What I get is some blank form with zero controls on it, I obviously didn't create it as all my forms have controls. SO I went into Program.cs to make sure the correct form was being starter

CODE

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace PC
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new frmBrowser());
        }
    }
}


As you can see, the last line Application.Run(new frmBrowser()); is indeed calling the correct form, so what the hell I supposed to do here?!?! I am now begging for help here folks, as most of you know this is not homework, please help me crazy.gif
User is online!Profile CardPM
+Quote Post

baavgai
RE: Disappearing Form
12 Dec, 2007 - 12:44 PM
Post #2

Dreaming Coder
Group Icon

Joined: 16 Oct, 2007
Posts: 2,019



Thanked: 105 times
Dream Kudos: 475
Expert In: C, C++, Java, C#, ASP.NET, PHP, Perl, Python, Oracle, SQL Server, MySql, HTML, JavaScript, Lua

My Contributions
Make extra special sure that
CODE

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);

Or any other Application. doesn't apear elsewhere, e.g. frmBrowser

Then, try startup where you set the instance to variable, so you can check it out in the debugger.
CODE

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
frmBrowser frm = new frmBrowser();
Application.Run(frm);


Also, try a more humble startup:
CODE

frmBrowser frm = new frmBrowser();
frm.showDialog();


Hope this helps. Looking forward to the solution.


User is offlineProfile CardPM
+Quote Post

Jayman
RE: Disappearing Form
12 Dec, 2007 - 01:16 PM
Post #3

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,926



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
Hmmm..interesting, I don't believe I have ever heard of a situation like this.

Is it possible to test your project on a different computer?
This way you can eliminate it as being a system specific issue as the cause of the problem.

Are these designer created controls or run-time?

Which version of VS are you using?

Did you perhaps edit the Designer generated code and remove something you shouldn't have?
VS does such a poor job of cleaning up, sometimes I have had to go into the designer generated code and remove code for controls that no longer exist and in the process have accidentally deleted code that I didn't intend. This has led to some very strange results from those deletions. Just a thought.

I am very curious to hear about the solution
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Disappearing Form
12 Dec, 2007 - 04:43 PM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
@jayman, all the controls are added at design time, none @ runtime. It has to be the frmBrowser file because I added it to a totally new project and the same thing happened, which means I get to start all over again from scratch blink.gif
User is online!Profile CardPM
+Quote Post

Jayman
RE: Disappearing Form
12 Dec, 2007 - 06:09 PM
Post #5

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 6,926



Thanked: 42 times
Dream Kudos: 500
Expert In: C#, VB.NET, Java

My Contributions
That really sucks. If you ever figure what the cause was, please post the solution. It has really got my curiosity up.
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Disappearing Form
22 Dec, 2007 - 06:03 AM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
I never found what was causing it, seems it was something in the form designer or the initilizecompoinent call when the form loaded. I had to delete the form and start all over again. I figured it better to spend 2 hours recreating a form than 4 trying to find out why it was disappearing in the first place. It was definitely odd to say the least.
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 11:50PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month