GAM3R
asked on
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());
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());
ASKER
I am specifying the skin through design.
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!
ASKER
Could you give an example?
ASKER
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
this.skinCrafter1.SkinFile
The skin file is in the debug folder, near the .exe
Hardcode the path this.skinCrafter1.SkinFile = Application.StartupPah + "\\vista_style.skf";
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:
For starters you want to remove the line:
this.skinCrafter1.SkinFile
Form the designer.cs, and then try adding the following to your form constructor:
this.skinCrafter1.SkinFile = Path.Combine(Application.StartupPath, "vista_style.skf");
ASKER
Tried both, the form still closes.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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)
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
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.
>>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.
One possibility is that it's having trouble locating the skin file. Are you specifying the skin file at design time, or through code?