472,977 Members | 1,703 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,977 software developers and data experts.

An unhandled exception of type 'System.NullReferenceException'

Hi, I hope I can find some help for this problem

IDE: Visual Studio.NET 2003 Developer Editio
Language: C#
Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll. Additional information: Object reference not set to an instance of an object.

Visual Studio's IDE is not allowing me to develop projects in C#... I've trying to create a simple Windows Forms project using Visual Studio.NET 2003 Enterprise Developer, and to code it using C#
As soon as I press F5, the exception is produced. Notice that I haven't placed any control on the form yet. And I haven't code anything. The only code that exists is the code-behind generated by Visual Studio

To be more precise, I'll describe the steps I've been performing

1) Select File>New>Project from Visual Studio IDE
2) Select C# as the language of preferenc
3) Select Windows Application
4) Click OK on the dialog form
5) Once the default window and code is generated..
6) Press F5

As it can be seen from the mentioned steps, I haven't coded anything neither inserted any control on the form. Just tried to run an empty Form, using the IDE's generated code. Of course, if any control is added to the form or something is coded, the exception is also produced

I'm tring to say that the exception is been produced by the code-behind generated. Not by anything added by me, since I haven't added anything

I'm pasting the code-behind in the following paragraphs to make it easy to see.
I would much appreciate any guide, help or suggestion to resolve this problem

=== Begining of cod
using System
using System.Drawing
using System.Collections
using System.ComponentModel
using System.Windows.Forms
using System.Data

namespace WindowsApplication1

/// <summary
/// Summary description for Form1
/// </summary
public class Form1 : System.Windows.Forms.For

/// <summary
/// Required designer variable
/// </summary
private System.ComponentModel.Container components = null

public Form1(

/
// Required for Windows Form Designer suppor
/
InitializeComponent()

/
// TODO: Add any constructor code after InitializeComponent cal
/
/// <summary
/// Clean up any resources being used
/// </summary
protected override void Dispose( bool disposing

if( disposing

if (components != null)

components.Dispose()
base.Dispose( disposing )
#region Windows Form Designer generated cod
/// <summary
/// Required method for Designer support - do not modif
/// the contents of this method with the code editor
/// </summary
private void InitializeComponent(

this.components = new System.ComponentModel.Container()
this.Size = new System.Drawing.Size(300,300)
this.Text = "Form1"

#endregio

/// <summary
/// The main entry point for the application
/// </summary
[STAThread
static void Main()

Application.Run(new Form1())

==== End of cod

Thank you very much in advance for your help.
Nov 22 '05 #1
1 5660
I can't reproduce this behavior. Perhaps you could post more information
as to the actual exception. i.e. Which object is null when it is being
accessed.

_Rick
--------------------
| Thread-Topic: An unhandled exception of type
'System.NullReferenceException'
| thread-index: AcPzT9a8IYy52dQURiur+t6Ma+ocsw==
| X-Tomcat-NG: microsoft.public.dotnet.general
| From: =?Utf-8?B?UmFmYWVs?= <an*******@discussions.microsoft.com>
| Subject: An unhandled exception of type 'System.NullReferenceException'
| Date: Sat, 14 Feb 2004 15:11:12 -0800
| Lines: 98
| Message-ID: <20**********************************@microsoft.co m>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.general
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:124655
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hi, I hope I can find some help for this problem.

IDE: Visual Studio.NET 2003 Developer Edition
Language: C#.
Problem: "An unhandled exception of type 'System.NullReferenceException'
occurred in system.windows.forms.dll. Additional information: Object
reference not set to an instance of an object."

Visual Studio's IDE is not allowing me to develop projects in C#... I've
trying to create a simple Windows Forms project using Visual Studio.NET
2003 Enterprise Developer, and to code it using C#.
As soon as I press F5, the exception is produced. Notice that I haven't
placed any control on the form yet. And I haven't code anything. The only
code that exists is the code-behind generated by Visual Studio.

To be more precise, I'll describe the steps I've been performing:

1) Select File>New>Project from Visual Studio IDE.
2) Select C# as the language of preference
3) Select Windows Application.
4) Click OK on the dialog form.
5) Once the default window and code is generated...
6) Press F5.

As it can be seen from the mentioned steps, I haven't coded anything
neither inserted any control on the form. Just tried to run an empty Form,
using the IDE's generated code. Of course, if any control is added to the
form or something is coded, the exception is also produced.

I'm tring to say that the exception is been produced by the code-behind
generated. Not by anything added by me, since I haven't added anything.

I'm pasting the code-behind in the following paragraphs to make it easy to
see.
I would much appreciate any guide, help or suggestion to resolve this
problem.

=== Begining of code
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace WindowsApplication12
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.Size = new System.Drawing.Size(300,300);
this.Text = "Form1";
}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}
==== End of code

Thank you very much in advance for your help.
|

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Rafael | last post by:
Hi, I hope I can find some help for this problem IDE: Visual Studio.NET 2003 Developer Editio Language: C# Problem: "An unhandled exception of type 'System.NullReferenceException' occurred in...
0
by: Rafiq Ganaie via .NET 247 | last post by:
HI, I am working on a search application in C#.It is a multithreaded application.it simply takes a URL,Downloads the page using WebRequest and WebResponse classes.Unfortunately it is throwing...
3
by: Professor Frink | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
3
by: cristiank | last post by:
hi everybody, I need to clear something out, does anybody have ever encountered such an exception until now : "Un unhandled exception of type System.NullReferenceException occurred in...
3
by: juli | last post by:
Hello! I keep getting this error: An unhandled exception of type 'System.NullReferenceException' occurred Additional information: Object reference not set to an instance of an object. I am...
4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
7
by: Chuck Hartman | last post by:
I have a Windows service that requests web pages from a site using an HttpWebRequest object. When I try to request a page from an ASP.NET 2 site, I get a WebException with message "The remote...
1
by: mike | last post by:
My program is crashing, but it doesn't crash on a single line of code. Below is what the output tab displays. I have no idea where to start inorder to debug this problem. Is there any suggesstions...
9
by: Supra | last post by:
i got error problem.......... An unhandled exception of type 'System.NullReferenceException' occurred in system.windows.forms.dll Additional information: Object reference not set to an instance of...
0
by: statlerw | last post by:
I have successfully implemented drag and drop in my application to allow the reordering of columns by dragging and dropping them in the same datagridvire (Net 2.0). If i take it relatively...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.