Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Error on Startup C#

Posted on 2010-08-12
11
Medium Priority
?
351 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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

Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

Question has a verified solution.

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

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…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

618 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