• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 355
  • Last Modified:

Error on Startup C#

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
GAM3R
Asked:
GAM3R
  • 4
  • 4
  • 2
  • +1
1 Solution
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
GAM3RAuthor Commented:
I am specifying the skin through design.
0
 
Carl TawnSystems and Integration DeveloperCommented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
GAM3RAuthor Commented:
Could you give an example?
0
 
GAM3RAuthor Commented:
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
 
yanochCommented:
Hardcode the path this.skinCrafter1.SkinFile = Application.StartupPah + "\\vista_style.skf";
0
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
GAM3RAuthor Commented:
Tried both, the form still closes.
0
 
Carl TawnSystems and Integration DeveloperCommented:
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
 
systanCommented:
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
 
systanCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 4
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now