Error - System.InvalidOperationException: De verzameling is gewijzigd.

Status
Niet open voor verdere reacties.

ongenae

Gebruiker
Lid geworden
20 okt 2010
Berichten
124
Hallo iedereen

Ik vind het altijd moeilijk om op 1 pc iets te ontwerpen maar het dan ook goed te laten draaien op andere pc's
bij één van de gebruikers krijg ik volgende foutmelding bij het afsluiten van een formulier (kruisje)

Kan iemand mij helpen om dit op te lossen.

Zie het einde van dit bericht voor meer informatie over het aanroepen
van JIT-foutopsporing (Just In Time) in plaats van dit dialoogvenster.

************** Tekst van uitzondering **************
System.InvalidOperationException: De verzameling is gewijzigd. Mogelijk wordt de inventarisatiebewerking niet uitgevoerd.
bij System.ThrowHelper.ThrowInvalidOperationException(ExceptionResource resource)
bij System.Collections.Generic.List`1.Enumerator.MoveNextRare()
bij System.Collections.Generic.List`1.Enumerator.MoveNext()
bij Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose(Boolean disposing)
bij Microsoft.VisualBasic.PowerPacks.ShapeContainer.Dispose(Boolean disposing)
bij System.ComponentModel.Component.Dispose()
bij System.Windows.Forms.Control.Dispose(Boolean disposing)
bij System.Windows.Forms.Form.Dispose(Boolean disposing)
bij DORMAfoquin.Volledigewandenbeheer.Dispose(Boolean disposing) in K:\DORMA Foquin Administratie\Application\Project\Volledigewandenbeheer.Designer.vb:regel 13
bij System.Windows.Forms.Form.WmClose(Message& m)
bij System.Windows.Forms.Form.WndProc(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
bij System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
bij System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Geladen assembly's **************
mscorlib
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.239 (RTMGDR.030319-2300)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
DORMAfoquin
Assembly-versie: 1.0.0.0
Win32-versie: 1.0.0.0
CodeBase: file:///K:/DORMA%20Foquin%20Administratie/Application/Project/bin/DORMAfoquin.exe
----------------------------------------
System.Windows.Forms
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.235 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.236 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
Microsoft.VisualBasic
Assembly-versie: 10.0.0.0
Win32-versie: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System.Core
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Data
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Xml
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Transactions
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_32/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------
System.Configuration
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Numerics
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Numerics/v4.0_4.0.0.0__b77a5c561934e089/System.Numerics.dll
----------------------------------------
Microsoft.VisualBasic.PowerPacks.Vs
Assembly-versie: 10.0.0.0
Win32-versie: 10.0.20911.1
CodeBase: file:///C:/Windows/assembly/GAC_MSIL/Microsoft.VisualBasic.PowerPacks.Vs/10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.PowerPacks.Vs.dll
----------------------------------------
mscorlib.resources
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.235 (RTMGDR.030319-2300)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/mscorlib.resources/v4.0_4.0.0.0_nl_b77a5c561934e089/mscorlib.resources.dll
----------------------------------------
System.Windows.Forms.resources
Assembly-versie: 4.0.0.0
Win32-versie: 4.0.30319.235 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms.resources/v4.0_4.0.0.0_nl_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------

************** JIT-foutopsporing **************
Als u JIT-foutopsporing wilt inschakelen, moet in het configuratiebestand voor deze
toepassing of computer (machine.config) de waarde
jitDebugging in het gedeelte system.windows.forms zijn ingesteld.
De toepassing moet ook zijn gecompileerd terwijl foutopsporing
was ingeschakeld.

Bijvoorbeeld:

<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>

Wanneer JIT-foutopsporing is ingeschakeld, worden onverwerkte uitzonderingen
naar het JIT-foutopsporingsprogramma gestuurd dat op de computer is geregistreerd
en worden niet door dit dialoogvenster verwerkt.
 
Kunnen wij de code zien waar het mis gaat? (regel 13)
 
Dit is het begin van mijn VB code, ik zie wel nergens de regelnummers staan :confused:

Code:
Imports System
Imports System.Runtime.InteropServices
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.IO
Imports System.Windows.Forms.Form
Imports System.Drawing.Printing

Public Class Volledigewandenbeheer

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
        'GEBRUIK TIMER OM FORMULIER TE ACTIVEREN (OMEWEG)
        Me.Focus()
        Timer1.Enabled = False
    End Sub

    Private Sub Volledigewandenbeheer_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs)
        Dim vwbeheer As New Login
        vwbeheer.ShowInTaskbar = False
        vwbeheer.Activate()
    End Sub


    Private Sub btnwisbijlagen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnwisbijlagen.Click
        lbldropofferte.Text = "DROP Offerte"
        lbldropdwg.Text = "DROP Dwg"
        lbldropfreigab.Text = "DROP Freigab"
        lbldropab.Text = "DROP Ab"
        lbldroppost.Text = "DROP Post"
        lstbijlage.Items.Clear()
    End Sub

    Private Sub bijlagenopslaan()

        On Error Resume Next

        'COPIEER BESTANDEN IN LABELS NAAR BIJHORENDE MAPPEN

        If txtdossiernr.Text = "" Then
            MsgBox("Het dossiernummer is niet ingevuld." & vbCrLf & "De bestanden kunnen niet worden opgeslaan.", MsgBoxStyle.Information, "MELDING")
            Exit Sub
        Else
        End If

        Dim basismap As String
        Dim dossier As String

        Dim offerte As String
        Dim dwg As String
        Dim freigab As String
        Dim ab As String
        Dim post As String

        Dim datumnu As Date
        Dim datumstring As String

        Dim destination As String
        Dim dotPosition As Integer
        Dim slashposition As Integer
        Dim filenameOnly As String
        Dim filenamefull As String

        datumnu = Date.Now
        datumstring = datumnu.ToString("MMMM dd yyyy - H mm ss")

        basismap = "K:\DORMA Foquin Administratie\Dossiers-Volledigewanden\"
        dossier = txtdossiernr.Text

        offerte = lbldropofferte.Text
        dwg = lbldropdwg.Text
        freigab = lbldropfreigab.Text
        ab = lbldropab.Text
        post = lbldroppost.Text

        'CONTROLE
        Dim drdossier As DirectoryInfo = New DirectoryInfo(basismap & dossier)
        If drdossier.Exists Then

            'COPIEREN
            If lbldropofferte.Text <> "DROP Offerte" Then
                dotPosition = offerte.LastIndexOf(".")
                slashposition = offerte.LastIndexOf("\")
                filenameOnly = offerte.Substring(dotPosition + 0)
                filenamefull = offerte.Substring(slashposition + 0)
                destination = basismap & dossier & "\offerte" & filenamefull
                File.Copy(offerte, destination)
            Else
            End If

            If lbldropdwg.Text <> "DROP Dwg" Then
                dotPosition = dwg.LastIndexOf(".")
                slashposition = dwg.LastIndexOf("\")
                filenameOnly = dwg.Substring(dotPosition + 0)
                filenamefull = dwg.Substring(slashposition + 0)
                destination = basismap & dossier & "\dwg" & filenamefull
                File.Copy(dwg, destination)
            Else
            End If

            If lbldropfreigab.Text <> "DROP Freigab" Then
                dotPosition = freigab.LastIndexOf(".")
                slashposition = freigab.LastIndexOf("\")
                filenameOnly = freigab.Substring(dotPosition + 0)
                filenamefull = freigab.Substring(slashposition + 0)
                destination = basismap & dossier & "\freigab" & filenamefull
                File.Copy(freigab, destination)
            Else
            End If

            If lbldropab.Text <> "DROP Ab" Then
                dotPosition = ab.LastIndexOf(".")
                slashposition = ab.LastIndexOf("\")
                filenameOnly = ab.Substring(dotPosition + 0)
                filenamefull = ab.Substring(slashposition + 0)
                destination = basismap & dossier & "\ab" & filenamefull
                File.Copy(ab, destination)
            Else
            End If

            If lbldroppost.Text <> "DROP Post" Then
                dotPosition = post.LastIndexOf(".")
                slashposition = post.LastIndexOf("\")
                filenameOnly = post.Substring(dotPosition + 0)
                filenamefull = post.Substring(slashposition + 0)
                destination = basismap & dossier & "\post" & filenamefull
                File.Copy(post, destination)
            Else
            End If

        Else
            MsgBox("De mappen voor dit dossiernummer zijn nog niet aangemaakt." & vbCrLf & "Gelieve dit eerst te doen voor dossier " & dossier & ".", MsgBoxStyle.Information, "MELDING")
        End If

        Call controleerbijlagen()


    End Sub
 
Waarschijnlijk te maken met de timer

Code:
1. Imports System
2. Imports System.Runtime.InteropServices
3. Imports System.Drawing
4. Imports System.ComponentModel
5. Imports System.Windows.Forms
6. Imports System.IO
7. Imports System.Windows.Forms.Form
8. Imports System.Drawing.Printing
9. 
10. Public Class Volledigewandenbeheer
11. 
12.     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
13.        'GEBRUIK TIMER OM FORMULIER TE ACTIVEREN (OMEWEG)
14.        Me.Focus()
15.        Timer1.Enabled = False
16.    End Sub
 
Laatst bewerkt:
Er kan geen foutmelding op een becommentarieerde regel plaatsvinden ;)
Schakel regelnummering eens in: Tools > Options > Text Editor > Basic > Editor > Line numbers
 
Regelnummering was ingeschakeld, vind ik ook raar:

line13.jpg


Zie screenshot in bijlage.
 
Bingo, de fout zit hem in de designer code:

[CPP]

<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Volledigewandenbeheer_Claims_document
Inherits System.Windows.Forms.Form

'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub

[/CPP]


Als ik alle lijntjes van die sub in commentaar zet werkt het nog steeds niet.
 
Laatst bewerkt:
'k Zou het zo niet weten.
En als je een nieuw project start met dezelfde controls en dezelfde code?
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan