473,396 Members | 1,590 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 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 5719
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...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.