Solved

Error on Startup C#

Posted on 2010-08-12
11
340 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
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…

839 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