Solved

Error on Startup C#

Posted on 2010-08-12
11
336 Views
Last Modified: 2013-12-17
Hello,

I am using C# with skin crafter. When I debug, my form show then it automatically give me an error saying, object not set to refference. The code that the error points to : Application.Run(new Editor());
0
Comment
Question by:GAM3R
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33422790
Ah the wonders of skincrafter!!

One possibility is that it's having trouble locating the skin file. Are you specifying the skin file at design time, or through code?
0
 

Author Comment

by:GAM3R
ID: 33423081
I am specifying the skin through design.
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33423226
OK, try removing the skin path through the designer and specifying it through code instead. I've used skincrafter in the the past and to be perfectly honest it was a complete pain in the backside!
0
 

Author Comment

by:GAM3R
ID: 33423241
Could you give an example?
0
 

Author Comment

by:GAM3R
ID: 33423254
This is what my code looks like in the designer.cs

this.skinCrafter1.SkinFile = "vista_style.skf";

The skin file is in the debug folder, near the .exe
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 3

Expert Comment

by:yanoch
ID: 33423290
Hardcode the path this.skinCrafter1.SkinFile = Application.StartupPah + "\\vista_style.skf";
0
 
LVL 52

Expert Comment

by:Carl Tawn
ID: 33423295
If i remember correctly (been a while since i used skincrafter) but it has trouble with relative paths.

For starters you want to remove the line:

    this.skinCrafter1.SkinFile = "vista_style.skf";

Form the designer.cs, and then try adding the following to your form constructor:


this.skinCrafter1.SkinFile = Path.Combine(Application.StartupPath, "vista_style.skf");

Open in new window

0
 

Author Comment

by:GAM3R
ID: 33423351
Tried both, the form still closes.
0
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 33423421
Is it definatley the skincrafter component causing the error? Do you have any other skincrafter related code in your constructor? Or in your form in general?
0
 
LVL 14

Expert Comment

by:systan
ID: 33423628
goto your project,    properties,    application   startup object, select a startup object, or you can select a form if you did create a form using create new project wizard.
eq.,(startup objects)
using System;

using System.Drawing;

using System.Windows.Forms;



//On this classes inside namespace,

//we can select at startup object:

//MyPen_C.xMyPen, MyPen_C.zMyPen, MyPen_C.yMyPen 



namespace MyPen_C

{//begin namespace



    // Class Startup yMyPen

    public class yMyPen : System.Windows.Forms.Form

    {

        private System.ComponentModel.Container components = null;

        public yMyPen()

        {

            this.BackColor=Color.Black;

        }

        [STAThread]

        static void Main() 

        {

            Application.Run(new yMyPen());

        }



    }



    // Class Startup xMyPen

    public class xMyPen : System.Windows.Forms.Form

    {

        private System.ComponentModel.Container components = null;

        public xMyPen()

        {

            this.BackColor = Color.Blue;

        }

        [STAThread]

        static void Main()

        {

            Application.Run(new xMyPen());

        }

     }



     // Class Startup zMyPen

     public class zMyPen : System.Windows.Forms.Form

     {

         private System.ComponentModel.Container components = null;

         public zMyPen()

         {

             this.BackColor = Color.Gold;

         }

         [STAThread]

         static void Main()

         {

             Application.Run(new zMyPen());

         }

     }





}//end namespace

Open in new window

0
 
LVL 14

Expert Comment

by:systan
ID: 33423669
And;

>>Application.Run(new Editor());
Maybe your Editor() is not named on your class, or you have not declared a function for it.

Please check according to my sample code.
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now