Solved

Error on Startup C#

Posted on 2010-08-12
11
339 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Linq Help 1 34
SSL https .net web site force redirect 3 31
Visual Studio 2015 Source Code Control 10 26
C#  Radio button search for Date not DateTime 4 30
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
I designed this idea while studying technology in the classroom.  This is a semester long project.  Students are asked to take photographs on a specific topic which they find meaningful, it can be a place or situation such as travel or homelessness.…
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

929 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

12 Experts available now in Live!

Get 1:1 Help Now