473,763 Members | 1,373 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

BUG in VB .NET 2003?

Hi to All,

I found the following issue, is this a bug?

Create a new project and, in the main form, add a listbox with a few sample
items. In the DoubleClick event of the listbox, add:

Me.Dispose()

Then run the project, double click on an item in the listbox to close the
window and then an Exception occurs.

What is the problem? I would like to close the form by double clicking on
the listbox...
Thank you,

Andy

Nov 20 '05 #1
14 3171
what's the exception?
"Andy" <no****@nospam. com> wrote in message
news:9F******** **************@ news2.tin.it...
Hi to All,

I found the following issue, is this a bug?

Create a new project and, in the main form, add a listbox with a few sample items. In the DoubleClick event of the listbox, add:

Me.Dispose()

Then run the project, double click on an item in the listbox to close the
window and then an Exception occurs.

What is the problem? I would like to close the form by double clicking on
the listbox...
Thank you,

Andy

Nov 20 '05 #2
In article <9F************ **********@news 2.tin.it>, no****@nospam.c om
says...
What is the problem? I would like to close the form by double clicking on
the listbox...


Try Me.Close().

--
Patrick Steele
Microsoft .NET MVP
http://weblogs.asp.net/psteele
Nov 20 '05 #3
Cor
Hi Andy,
You are not closing it, you are killing it, look at the message from Patrick
Cor
Nov 20 '05 #4
Not a bug. Do not Dispose() in a click event. I am not real Windows Forms
savvy, but there is a way to close the form. You can Dispose() afterward,
but you have to make sure there is a Dispose() method coded for the class
you are disposing. Not sure if a form class has a Dispose() method without
adding IDisposable. Either way, you do not want to Dispose() the object in
the object.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** *************** **********
Think Outside the Box!
*************** *************** *************** *************** **********
"Andy" <no****@nospam. com> wrote in message
news:9F******** **************@ news2.tin.it...
Hi to All,

I found the following issue, is this a bug?

Create a new project and, in the main form, add a listbox with a few sample items. In the DoubleClick event of the listbox, add:

Me.Dispose()

Then run the project, double click on an item in the listbox to close the
window and then an Exception occurs.

What is the problem? I would like to close the form by double clicking on
the listbox...
Thank you,

Andy

Nov 20 '05 #5
Something like "Cannot access disposed object named "ListBox"

Andy
"steve" <as*@abc.com> ha scritto nel messaggio
news:vn******** ****@corp.super news.com...
what's the exception?


Nov 20 '05 #6
The same Exception happens also with "Me.Close() "...

Andy
"Patrick Steele [MVP]" <pa*****@mvps.o rg> ha scritto nel messaggio
news:MP******** *************** *@msnews.micros oft.com...
In article <9F************ **********@news 2.tin.it>, no****@nospam.c om
says...
What is the problem? I would like to close the form by double clicking on the listbox...


Try Me.Close().


Nov 20 '05 #7
But I need to close (unload) the form from a double click event...

I searched with google and, strangely, in the first version of VB6 there was
a bug: if you tried to unload the form from a listbox's doubleclick event, a
GPF occurred. This was solved in later SP. What coincidence!

Andy

"msnews.microso ft.com" <No************ @comcast.netNoS pamM> ha scritto nel
messaggio news:#G******** ******@tk2msftn gp13.phx.gbl...
Not a bug. Do not Dispose() in a click event. I am not real Windows Forms
savvy, but there is a way to close the form. You can Dispose() afterward,
but you have to make sure there is a Dispose() method coded for the class
you are disposing. Not sure if a form class has a Dispose() method without
adding IDisposable. Either way, you do not want to Dispose() the object in
the object.


Nov 20 '05 #8
The point I am getting at is Dispose() is not the proper way to destroy an
object from inside the object. I would aim for close, but you are stating
you are getting the same message there. I do not understand the need to
close from doubleclick rather than set up a close button, but each app is
different.

This causes no problems for me in VS.NET 2003:

Private Sub ListBox1_Double Click(ByVal sender As Object, ByVal e As
System.EventArg s) _
Handles ListBox1.Double Click
Try
Me.Close()
Catch ex As Exception
MessageBox.Show (ex.Message)
'Finally
' MessageBox.Show ("In Finally")
End Try
End Sub

unless I uncomment the Finally. This makes sense, as I have closed the form
by this point in time. I cannot run through debug on this machine, as I need
to catch someone to get permissions (aaarrrggghhhh! !!).

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

*************** *************** *************** *************** **********
Think Outside the Box!
*************** *************** *************** *************** **********
"Andy" <no****@nospam. com> wrote in message
news:fW******** **************@ news2.tin.it...
But I need to close (unload) the form from a double click event...

I searched with google and, strangely, in the first version of VB6 there was a bug: if you tried to unload the form from a listbox's doubleclick event, a GPF occurred. This was solved in later SP. What coincidence!

Andy

"msnews.microso ft.com" <No************ @comcast.netNoS pamM> ha scritto nel
messaggio news:#G******** ******@tk2msftn gp13.phx.gbl...
Not a bug. Do not Dispose() in a click event. I am not real Windows Forms savvy, but there is a way to close the form. You can Dispose() afterward, but you have to make sure there is a Dispose() method coded for the class you are disposing. Not sure if a form class has a Dispose() method without adding IDisposable. Either way, you do not want to Dispose() the object in the object.


Nov 20 '05 #9
Try adding

Application.DoE vents before the close method...

I do'nt know if it will work, but dispose is for garbage collection, and not
the right way to shut down a window. Close calls dispose through Finalize I
believe.
"Andy" <no****@nospam. com> wrote in message
news:QT******** **************@ news2.tin.it...
The same Exception happens also with "Me.Close() "...

Andy
"Patrick Steele [MVP]" <pa*****@mvps.o rg> ha scritto nel messaggio
news:MP******** *************** *@msnews.micros oft.com...
In article <9F************ **********@news 2.tin.it>, no****@nospam.c om
says...
What is the problem? I would like to close the form by double clicking on the listbox...


Try Me.Close().


Nov 20 '05 #10

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

Similar topics

1
4860
by: David Lee | last post by:
Need some help bad here. Am using VB.Net Standard 2003 supplied for a class and I need to install Msde and the sample databases to work on homework. Following the documentation I can download sql2kdesksp3.exe and get the server running. I cannot then install the sample databases according to directions. Log file follows: 2:28:26 AM Wednesday, October 01, 2003: 12:28:26 AM Wednesday, October 01, 2003: Modified the sourceview node of...
0
6137
by: Tom Lee | last post by:
Hi, I'm new to .NET 2003 compiler. When I tried to compile my program using DEBUG mode, I got the following errors in the C:\Program Files\Microsoft Visual Studio .NET 2003\Vc7 \include\xdebug file as folows. I need help to resolve them ASAP: cl /c /nologo /MDd /W3 /Od /GR /GM /Zi /GX /D "_DEBUG" /D " WIN32" /D "_W INDOWS" /D "_WINDLL" /D "_AFXDLL" /D "_MBCS" /D "_USRDLL" /
6
2145
by: David Waz... | last post by:
Moved an app from W/2000 Asp V1.0 to W/2003, VS/2003, ASPV 1.1 Page runs a long job, uploading 2 large fixed length files (300,000 rows) into SQL database. A process is run against the data, and altered flat-files produced. The job aborts at EXACTLY 105 seconds (1 min, 45 seconds) regardless of WHERE in the process we are - could be DB read, DB write, string manipulation - whatever.
22
3304
by: EP | last post by:
When running my asp.net hosting service (asp.net without IIS), on server 2003 with IIS not installed, I get the following when trying to process a request. "System.DllNotFoundException: Unable to load DLL (aspnet_isapi.dll)." Of course the dll is able to be found, it's still in the framework directory and for grins I even put it in my service's local directory. This is apparantly server 2003 not allowing asp.net to be run if IIS was not...
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9998
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8822
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5270
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5406
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3523
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.