Solved

Error on Startup C#

Posted on 2010-08-12
11
341 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

 

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
 
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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Introduction Hi all and welcome to my first article on Experts Exchange. A while ago, someone asked me if i could do some tutorials on object oriented programming. I decided to do them on C#. Now you may ask me, why's that? Well, one of the re…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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