Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2006

Tip: Looking for answers? Try searching our database.

Application Ecit In Win Forms 2.0

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
keal75 - 07 Jul 2006 21:56 GMT
All,
I'm getting this exception error when I attempt to exit out a Win Forms 2.0
application with the following sample code:
   Private Sub RaythomConfiguration_FormClosing(ByVal sender As Object,
ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
       If MsgBox("Are You Sure You Want To Close?", MsgBoxStyle.YesNo) =
MsgBoxResult.Yes Then
           Me.Dispose()
       Else
           e.Cancel = System.Windows.Forms.DialogResult.No
       End If
   End Sub

   Private Sub btncancel_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btncancel.Click
       Me.Close()
   End Sub

   Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnexit.Click
       Application.Exit()
   End Sub

The eror message is as follows:
System.InvalidOperationException was unhandled
 Message="Collection was modified; enumeration operation may not execute."
 Source="mscorlib"

How do I exit out when i'm using the Form_Closing sub routine? Any help
would be greatly appreciated?

Thanks,
Signature

keal75

Brian P. Hammer - 07 Jul 2006 22:07 GMT
I think if you remove me.dispose, you should be okay.  If you are trying to
close the entire app, use application.exit.

Brian

> All,
> I'm getting this exception error when I attempt to exit out a Win Forms
[quoted text clipped - 30 lines]
>
> Thanks,

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.