473,396 Members | 1,859 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.

MyBase.Dispose: NullReferenceException was unhandled

Hi,

I've got this problem:

I currently work on a control which inherits from ListBox.
In my control I shadowed the Items with a custom ObjectCollection, which
has some additional properties.

Now, this happens:
If I add some entries to my control, click on one of the items and then
close the form with the control on it, I get this error message:

NullReferenceException was unhandled
Object reference not set to an instance of an object

The error occurs in the form's Dispose method at MyBase.Dispose.

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
I have no clue how to identify the problem, especially since I can
deactivate the click routine and the error still occurs...

Any ideas what the problem could be?

Thanks a lot in advance!

Best regards,

Martin
Apr 4 '07 #1
5 2730
Matt,

What do you have in the disposing from the by you derived Listbox

Cor

"Martin H." <hk***@gmx.netschreef in bericht
news:46***********************@news.freenet.de...
Hi,

I've got this problem:

I currently work on a control which inherits from ListBox.
In my control I shadowed the Items with a custom ObjectCollection, which
has some additional properties.

Now, this happens:
If I add some entries to my control, click on one of the items and then
close the form with the control on it, I get this error message:

NullReferenceException was unhandled
Object reference not set to an instance of an object

The error occurs in the form's Dispose method at MyBase.Dispose.

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
I have no clue how to identify the problem, especially since I can
deactivate the click routine and the error still occurs...

Any ideas what the problem could be?

Thanks a lot in advance!

Best regards,

Martin

Apr 5 '07 #2
Hello Cor,
What do you have in the disposing from the by you derived Listbox
I did not write any code for disposing my custom listbox.

Best regards,

Martin
Apr 5 '07 #3
On Apr 4, 2:55 pm, "Martin H." <h...@gmx.netwrote:
Hi,

I've got this problem:

I currently work on a control which inherits from ListBox.
In my control I shadowed the Items with a custom ObjectCollection, which
has some additional properties.

Now, this happens:
If I add some entries to my control, click on one of the items and then
close the form with the control on it, I get this error message:

NullReferenceException was unhandled
Object reference not set to an instance of an object

The error occurs in the form's Dispose method at MyBase.Dispose.

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

I have no clue how to identify the problem, especially since I can
deactivate the click routine and the error still occurs...

Any ideas what the problem could be?

Thanks a lot in advance!

Best regards,

Martin
Hi,

Can you post a short, but complete program demonstrating the problem?

Brian

Apr 5 '07 #4
Hello Brian,
Can you post a short, but complete program demonstrating the problem?
You can download the test project from
http://www.henke-hk.com/download/DisposeProblem.zip

Thanks in advance.

Happy holidays!

Martin
Apr 6 '07 #5
Hi everybody,

I've got the problem solved. It occurred, because I did not add any
items to the base class.

Thanks to all for your help.

Best regards,

Martin
Apr 11 '07 #6

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

Similar topics

7
by: mike p. | last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl stylesheets to do xhtml transform. Transform works fine when using MSXML. When I try to do the following using asp.net 1.1: ...
7
by: David Elliott | last post by:
I have created an application that will dynamically load other DLLs (plugins). The new plugin is a winform with an embedded IE Browser. I am wanting to have the form to run in its own thread....
3
by: msnews.microsoft.com | last post by:
actaully the code i have written below is pretty simple and short. no idea why it terminate at run-time with "An unhandled exception of type 'System.NullReferenceException' occurred" Thank you ...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
2
by: sxiao | last post by:
Hi, there I got a NullReferenceException when there are more than one users trying to open the same page at the same time. The senerio is: Two users logged into the web application using the...
3
by: dave | last post by:
I have an object employee that is derived from person object. In .net 1.1 the following procedure worked without any problem. In 2.0 i get the nullreferenceexceptionerror. What could be going on...
5
by: Saber | last post by:
in <system.web> of web.config I've: <profile> <properties> <add name="EnterTime" type="System.DateTime" allowAnonymous="true"/> </properties> </profile> And in Session_Start of global.asax:
1
by: kuhrty | last post by:
Hi, I am creating a multi-winform project. Everything has been working fine, except after I perform an update to the database and decide to Exit the winform after the update operation is...
1
by: mdhaman | last post by:
hi, I have a windows service written in VB.Net and framework 2.0. It is a multithread service and it is using threadpool to manage threads. Recently I have started getting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.