Я получаю Коллекция была изменена;Операция перечисления не может выполнить ошибку каждый раз, когда я пытаюсь закрыть эту форму.Я подозреваю, что это как-то связано с StringBuilder (), который я объявил в начальной форме (Details1).Я уже часами искал проблему.Он не выдает ошибку при отладке, только при установке на другие машины.
Пожалуйста, помогите.
> Public Class PLocation
>
> Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
> Label2.Text = ""
> Dim showForm As Form = My.Settings.PreviousForm
> showForm.Show()
> Me.Hide()
> End Sub
>
> Private Sub PLocation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
> Label2.Text = ""
> Label1.Text = My.Settings.CurrentProject1
> Label6.Text = My.Settings.UserInitials1
> Label5.Text = My.Settings.CurrentDataPath1
> Label7.Text = My.Settings.EquipID1
> Label8.Text = My.Settings.CurrentPunchItem1
> Home.Details1.Clear()
>
> End Sub
>
> Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
> Dim ExitBox As MsgBoxResult = MessageBox.Show("Are you sure you want to CLOSE this program?", _
> "WARNING", _
> MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
>
> 'If Yes, then delete
> If ExitBox = MsgBoxResult.Yes Then
> Home.Close()
>
> End If
> End Sub
>
>
>
> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
> If TextBox1.Text.Contains(",") Then
> Label2.Text = "Remove commas in comment box."
> Else
> Label2.Text = ""
> If CheckBox1.Checked Then
> Home.Details1.Append("Breakover; ")
> End If
>
> If CheckBox2.Checked Then
> Home.Details1.Append("Chute; ")
> End If
>
> If CheckBox3.Checked Then
> Home.Details1.Append("Drive pulley; ")
> End If
>
> If CheckBox4.Checked Then
> Home.Details1.Append("End pulley; ")
> End If
> If CheckBox5.Checked Then
> Home.Details1.Append("Return roller; ")
> End If
> If CheckBox6.Checked Then
> Home.Details1.Append("Sideguard; ")
> End If
> If CheckBox7.Checked Then
> Home.Details1.Append("Slider bed; ")
> End If
> If CheckBox8.Checked Then
> Home.Details1.Append("Snub; ")
> End If
> If CheckBox9.Checked Then
> Home.Details1.Append("Take-up; ")
> End If
> If CheckBox10.Checked Then
> Home.Details1.Append("Head end; ")
> End If
> If CheckBox11.Checked Then
> Home.Details1.Append("Tail end; ")
> End If
> If CheckBox12.Checked Then
> Home.Details1.Append("Drive section; ")
> End If
> If CheckBox13.Checked Then
> Home.Details1.Append("Middle; ")
> End If
> If CheckBox14.Checked Then
> Home.Details1.Append("Left side; ")
> End If
> If CheckBox15.Checked Then
> Home.Details1.Append("Right side; ")
> End If
> If CheckBox16.Checked Then
> Home.Details1.Append("at joint ; ")
> End If
> If CheckBox17.Checked Then
> Home.Details1.Append("Top side; ")
> End If
> If CheckBox18.Checked Then
> Home.Details1.Append("Bottom side; ")
> End If
> If CheckBox19.Checked Then
> Home.Details1.Append("Insider / Inner; ")
> End If
> If CheckBox20.Checked Then
> Home.Details1.Append("Outside / Outer; ")
> End If
> If CheckBox21.Checked Then
> Home.Details1.Append("Above; ")
> End If
> If CheckBox22.Checked Then
> Home.Details1.Append("Below; ")
> End If
> If CheckBox23.Checked Then
> Home.Details1.Append("Lower; ")
> End If
> If CheckBox24.Checked Then
> Home.Details1.Append("Upper; ")
> End If
> If CheckBox27.Checked Then
> Home.Details1.Append("Bad installation; ")
> End If
> If CheckBox28.Checked Then
> Home.Details1.Append("Bent; ")
> End If
> If CheckBox29.Checked Then
> Home.Details1.Append("Damaged; ")
> End If
> If CheckBox30.Checked Then
> Home.Details1.Append("Dented; ")
> End If
> If CheckBox31.Checked Then
> Home.Details1.Append("Gap; ")
> End If
> If CheckBox32.Checked Then
> Home.Details1.Append("Incomplete; ")
> End If
> If CheckBox33.Checked Then
> Home.Details1.Append("Insufficient; ")
> End If
> If CheckBox34.Checked Then
> Home.Details1.Append("Loose; ")
> End If
> If CheckBox35.Checked Then
> Home.Details1.Append("Misaligned; ")
> End If
> If CheckBox36.Checked Then
> Home.Details1.Append("No access; ")
> End If
> If CheckBox37.Checked Then
> Home.Details1.Append("Uneven; ")
> End If
> If CheckBox38.Checked Then
> Home.Details1.Append("Not installed; ")
> End If
> If CheckBox39.Checked Then
> Home.Details1.Append("Not straight; ")
> End If
> If CheckBox40.Checked Then
> Home.Details1.Append("Rusted; ")
> End If
> If CheckBox41.Checked Then
> Home.Details1.Append("Sharp edges; ")
> End If
> If CheckBox42.Checked Then
> Home.Details1.Append("Too large; ")
> End If
> If CheckBox43.Checked Then
> Home.Details1.Append("Too long; ")
> End If
> If CheckBox44.Checked Then
> Home.Details1.Append("Too short; ")
> End If
> If CheckBox45.Checked Then
> Home.Details1.Append("Too Small; ")
> End If
> If CheckBox46.Checked Then
> Home.Details1.Append("Wrong type; ")
> End If
> If CheckBox47.Checked Then
> Home.Details1.Append("Wrong color; ")
> End If
> If CheckBox48.Checked Then
> Home.Details1.Append("Wrong size; ")
> End If
> If CheckBox25.Checked Then
> Home.Details1.Append("times 2; ")
> End If
> If CheckBox26.Checked Then
> Home.Details1.Append("times 3; ")
> End If
> If TextBox1.Text = "" Then
> 'do nothing
> Else
> Home.Details1.Append(", " & TextBox1.Text)
> End If
>
> Home.Details2 = Home.Details1.ToString
> Summary.Show()
> Me.Close()
>
> End If
> End Sub
>
>
>
> Private Sub Label16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
> About.Show()
> End Sub
>
>
> End Class
>
***** Текст исключения ******* System.InvalidOperationException: Коллекция была изменена;Операция перечисления может не выполняться.в System.ThrowHelper.ThrowInvalidOperationException (ресурс ExceptionResource) в System.Collections.Generic.List 1.Enumerator.MoveNextRare() at
System.Collections.Generic.List
1.Enumerator.MoveNext () в Microsoft.VisualBasic.PowerPacks.ShapeCollection.Dispose (логическое удаление) в Microsoft.VisualPer..Dispose (логическое удаление) в System.ComponentModel.Component.Dispose () в System.Windows.Forms.Control.Dispose (логическое удаление) в System.Windows.Forms.Form.Dispose (логическое удаление) в WindowsApplication1.PLocation.Dispose(Логическое удаление) в System.ComponentModel.Component.Dispose () в System.Windows.Forms.Form.WmClose (Message & m) в System.Windows.Forms.Form.WndProc (Message & m) в System.Windows.Forms.Control.ControlNativeWindow.OnMessage (Message & m) в System.Windows.Forms.Control.ControlNativeWindow.WndProc (Message & m) в System.Windows.Forms.NativeWindow.Callback (IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr 10 lparam)