I was working on a VB.net project and at one point, I could not edit the design of any form due to this error:
The designer cannot process the code at line 259, please see the Task List for details. The code within the method 'InitializeComponent' is generated by the designer and should not be manually modified. Please remove any changes and try opening the designer again.
It was working just fine before and I made no changes to the forms themselves. The only modification I made to this file was adding
Inherits MetroFramework.Forms.MetroForm
And removing that and replacing it with the original System.Windows.Forms.Form did not solve the problem.
Here is one of the form's code:
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Config
Inherits MetroFramework.Forms.MetroForm
'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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.TTime = New MetroFramework.Controls.MetroTextBox()
Me.MetroLabel1 = New MetroFramework.Controls.MetroLabel()
Me.MetroLabel2 = New MetroFramework.Controls.MetroLabel()
Me.MetroPanel1 = New MetroFramework.Controls.MetroPanel()
Me.MetroLabel3 = New MetroFramework.Controls.MetroLabel()
Me.MetroPanel2 = New MetroFramework.Controls.MetroPanel()
Me.MetroLabel4 = New MetroFramework.Controls.MetroLabel()
Me.MetroLabel5 = New MetroFramework.Controls.MetroLabel()
Me.BlackoutFrom = New MetroFramework.Controls.MetroComboBox()
Me.BlackoutTo = New MetroFramework.Controls.MetroComboBox()
Me.MetroLabel6 = New MetroFramework.Controls.MetroLabel()
Me.MetroPanel3 = New MetroFramework.Controls.MetroPanel()
Me.MetroLabel7 = New MetroFramework.Controls.MetroLabel()
Me.MinBox = New MetroFramework.Controls.MetroTextBox()
Me.MetroLabel8 = New MetroFramework.Controls.MetroLabel()
Me.MetroButton1 = New MetroFramework.Controls.MetroButton()
Me.MetroButton2 = New MetroFramework.Controls.MetroButton()
Me.MetroButton3 = New MetroFramework.Controls.MetroButton()
Me.PasswordBox = New MetroFramework.Controls.MetroTextBox()
Me.MetroLabel9 = New MetroFramework.Controls.MetroLabel()
Me.MetroButton4 = New MetroFramework.Controls.MetroButton()
Me.MetroToolTip1 = New MetroFramework.Components.MetroToolTip()
Me.MetroPanel1.SuspendLayout()
Me.MetroPanel2.SuspendLayout()
Me.MetroPanel3.SuspendLayout()
Me.SuspendLayout()
'
'TTime
'
Me.TTime.Lines = New String() {"0"}
Me.TTime.Location = New System.Drawing.Point(87, 33)
Me.TTime.MaxLength = 32767
Me.TTime.Name = "TTime"
Me.TTime.PasswordChar = Global.Microsoft.VisualBasic.ChrW(0)
Me.TTime.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.TTime.SelectedText = ""
Me.TTime.Size = New System.Drawing.Size(32, 23)
Me.TTime.TabIndex = 0
Me.TTime.Text = "0"
Me.TTime.UseSelectable = True
'
'MetroLabel1
'
Me.MetroLabel1.AutoSize = True
Me.MetroLabel1.Location = New System.Drawing.Point(8, 34)
Me.MetroLabel1.Name = "MetroLabel1"
Me.MetroLabel1.Size = New System.Drawing.Size(73, 19)
Me.MetroLabel1.TabIndex = 1
Me.MetroLabel1.Text = "Time Limit:"
'
'MetroLabel2
'
Me.MetroLabel2.AutoSize = True
Me.MetroLabel2.Location = New System.Drawing.Point(126, 33)
Me.MetroLabel2.Name = "MetroLabel2"
Me.MetroLabel2.Size = New System.Drawing.Size(43, 19)
Me.MetroLabel2.TabIndex = 2
Me.MetroLabel2.Text = "Hours"
'
'MetroPanel1
'
Me.MetroPanel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.MetroPanel1.Controls.Add(Me.MetroLabel3)
Me.MetroPanel1.Controls.Add(Me.MetroLabel2)
Me.MetroPanel1.Controls.Add(Me.MetroLabel1)
Me.MetroPanel1.Controls.Add(Me.TTime)
Me.MetroPanel1.HorizontalScrollbarBarColor = True
Me.MetroPanel1.HorizontalScrollbarHighlightOnWheel = False
Me.MetroPanel1.HorizontalScrollbarSize = 10
Me.MetroPanel1.Location = New System.Drawing.Point(123, 78)
Me.MetroPanel1.Name = "MetroPanel1"
Me.MetroPanel1.Size = New System.Drawing.Size(186, 75)
Me.MetroPanel1.TabIndex = 3
Me.MetroPanel1.VerticalScrollbarBarColor = True
Me.MetroPanel1.VerticalScrollbarHighlightOnWheel = False
Me.MetroPanel1.VerticalScrollbarSize = 10
'
'MetroLabel3
'
Me.MetroLabel3.AutoSize = True
Me.MetroLabel3.FontSize = MetroFramework.MetroLabelSize.Tall
Me.MetroLabel3.Location = New System.Drawing.Point(36, 0)
Me.MetroLabel3.Name = "MetroLabel3"
Me.MetroLabel3.Size = New System.Drawing.Size(113, 25)
Me.MetroLabel3.TabIndex = 4
Me.MetroLabel3.Text = "Time Settings"
'
'MetroPanel2
'
Me.MetroPanel2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.MetroPanel2.Controls.Add(Me.BlackoutTo)
Me.MetroPanel2.Controls.Add(Me.MetroLabel6)
Me.MetroPanel2.Controls.Add(Me.BlackoutFrom)
Me.MetroPanel2.Controls.Add(Me.MetroLabel5)
Me.MetroPanel2.Controls.Add(Me.MetroLabel4)
Me.MetroPanel2.HorizontalScrollbarBarColor = True
Me.MetroPanel2.HorizontalScrollbarHighlightOnWheel = False
Me.MetroPanel2.HorizontalScrollbarSize = 10
Me.MetroPanel2.Location = New System.Drawing.Point(23, 159)
Me.MetroPanel2.Name = "MetroPanel2"
Me.MetroPanel2.Size = New System.Drawing.Size(186, 121)
Me.MetroPanel2.TabIndex = 4
Me.MetroPanel2.VerticalScrollbarBarColor = True
Me.MetroPanel2.VerticalScrollbarHighlightOnWheel = False
Me.MetroPanel2.VerticalScrollbarSize = 10
'
'MetroLabel4
'
Me.MetroLabel4.AutoSize = True
Me.MetroLabel4.FontSize = MetroFramework.MetroLabelSize.Tall
Me.MetroLabel4.Location = New System.Drawing.Point(20, 0)
Me.MetroLabel4.Name = "MetroLabel4"
Me.MetroLabel4.Size = New System.Drawing.Size(140, 25)
Me.MetroLabel4.TabIndex = 5
Me.MetroLabel4.Text = "Blackout Settings"
'
'MetroLabel5
'
Me.MetroLabel5.AutoSize = True
Me.MetroLabel5.Location = New System.Drawing.Point(36, 39)
Me.MetroLabel5.Name = "MetroLabel5"
Me.MetroLabel5.Size = New System.Drawing.Size(41, 19)
Me.MetroLabel5.TabIndex = 6
Me.MetroLabel5.Text = "From"
'
'BlackoutFrom
'
Me.BlackoutFrom.FormattingEnabled = True
Me.BlackoutFrom.ItemHeight = 23
Me.BlackoutFrom.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"})
Me.BlackoutFrom.Location = New System.Drawing.Point(83, 35)
Me.BlackoutFrom.Name = "BlackoutFrom"
Me.BlackoutFrom.Size = New System.Drawing.Size(56, 29)
Me.BlackoutFrom.TabIndex = 7
Me.BlackoutFrom.UseSelectable = True
'
'BlackoutTo
'
Me.BlackoutTo.FormattingEnabled = True
Me.BlackoutTo.ItemHeight = 23
Me.BlackoutTo.Items.AddRange(New Object() {"1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24"})
Me.BlackoutTo.Location = New System.Drawing.Point(83, 71)
Me.BlackoutTo.Name = "BlackoutTo"
Me.BlackoutTo.Size = New System.Drawing.Size(56, 29)
Me.BlackoutTo.TabIndex = 9
Me.BlackoutTo.UseSelectable = True
'
'MetroLabel6
'
Me.MetroLabel6.AutoSize = True
Me.MetroLabel6.Location = New System.Drawing.Point(55, 76)
Me.MetroLabel6.Name = "MetroLabel6"
Me.MetroLabel6.Size = New System.Drawing.Size(22, 19)
Me.MetroLabel6.TabIndex = 8
Me.MetroLabel6.Text = "To"
'
'MetroPanel3
'
Me.MetroPanel3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me.MetroPanel3.Controls.Add(Me.MetroButton3)
Me.MetroPanel3.Controls.Add(Me.MetroButton2)
Me.MetroPanel3.Controls.Add(Me.MetroButton1)
Me.MetroPanel3.Controls.Add(Me.MetroLabel8)
Me.MetroPanel3.Controls.Add(Me.MinBox)
Me.MetroPanel3.Controls.Add(Me.MetroLabel7)
Me.MetroPanel3.HorizontalScrollbarBarColor = True
Me.MetroPanel3.HorizontalScrollbarHighlightOnWheel = False
Me.MetroPanel3.HorizontalScrollbarSize = 10
Me.MetroPanel3.Location = New System.Drawing.Point(221, 159)
Me.MetroPanel3.Name = "MetroPanel3"
Me.MetroPanel3.Size = New System.Drawing.Size(200, 121)
Me.MetroPanel3.TabIndex = 5
Me.MetroPanel3.VerticalScrollbarBarColor = True
Me.MetroPanel3.VerticalScrollbarHighlightOnWheel = False
Me.MetroPanel3.VerticalScrollbarSize = 10
'
'MetroLabel7
'
Me.MetroLabel7.AutoSize = True
Me.MetroLabel7.FontSize = MetroFramework.MetroLabelSize.Tall
Me.MetroLabel7.Location = New System.Drawing.Point(48, 0)
Me.MetroLabel7.Name = "MetroLabel7"
Me.MetroLabel7.Size = New System.Drawing.Size(106, 25)
Me.MetroLabel7.TabIndex = 5
Me.MetroLabel7.Text = "Modify Time"
'
'MinBox
'
Me.MinBox.Lines = New String() {"30"}
Me.MinBox.Location = New System.Drawing.Point(92, 29)
Me.MinBox.MaxLength = 32767
Me.MinBox.Name = "MinBox"
Me.MinBox.PasswordChar = Global.Microsoft.VisualBasic.ChrW(0)
Me.MinBox.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.MinBox.SelectedText = ""
Me.MinBox.Size = New System.Drawing.Size(75, 23)
Me.MinBox.TabIndex = 6
Me.MinBox.Text = "30"
Me.MinBox.UseSelectable = True
'
'MetroLabel8
'
Me.MetroLabel8.AutoSize = True
Me.MetroLabel8.Location = New System.Drawing.Point(29, 31)
Me.MetroLabel8.Name = "MetroLabel8"
Me.MetroLabel8.Size = New System.Drawing.Size(57, 19)
Me.MetroLabel8.TabIndex = 7
Me.MetroLabel8.Text = "Minutes:"
'
'MetroButton1
'
Me.MetroButton1.Location = New System.Drawing.Point(48, 58)
Me.MetroButton1.Name = "MetroButton1"
Me.MetroButton1.Size = New System.Drawing.Size(43, 23)
Me.MetroButton1.TabIndex = 8
Me.MetroButton1.Text = "Add"
Me.MetroButton1.UseSelectable = True
'
'MetroButton2
'
Me.MetroButton2.Location = New System.Drawing.Point(97, 58)
Me.MetroButton2.Name = "MetroButton2"
Me.MetroButton2.Size = New System.Drawing.Size(50, 23)
Me.MetroButton2.TabIndex = 9
Me.MetroButton2.Text = "Remove"
Me.MetroButton2.UseSelectable = True
'
'MetroButton3
'
Me.MetroButton3.Location = New System.Drawing.Point(48, 87)
Me.MetroButton3.Name = "MetroButton3"
Me.MetroButton3.Size = New System.Drawing.Size(99, 23)
Me.MetroButton3.TabIndex = 10
Me.MetroButton3.Text = "Reset Timer"
Me.MetroButton3.UseSelectable = True
'
'PasswordBox
'
Me.PasswordBox.Lines = New String(-1) {}
Me.PasswordBox.Location = New System.Drawing.Point(214, 293)
Me.PasswordBox.MaxLength = 32767
Me.PasswordBox.Name = "PasswordBox"
Me.PasswordBox.PasswordChar = Global.Microsoft.VisualBasic.ChrW(9679)
Me.PasswordBox.ScrollBars = System.Windows.Forms.ScrollBars.None
Me.PasswordBox.SelectedText = ""
Me.PasswordBox.Size = New System.Drawing.Size(96, 23)
Me.PasswordBox.TabIndex = 6
Me.PasswordBox.UseSelectable = True
Me.PasswordBox.UseSystemPasswordChar = True
'
'MetroLabel9
'
Me.MetroLabel9.AutoSize = True
Me.MetroLabel9.Location = New System.Drawing.Point(143, 295)
Me.MetroLabel9.Name = "MetroLabel9"
Me.MetroLabel9.Size = New System.Drawing.Size(66, 19)
Me.MetroLabel9.TabIndex = 7
Me.MetroLabel9.Text = "Password:"
'
'MetroButton4
'
Me.MetroButton4.Location = New System.Drawing.Point(176, 322)
Me.MetroButton4.Name = "MetroButton4"
Me.MetroButton4.Size = New System.Drawing.Size(84, 23)
Me.MetroButton4.Style = MetroFramework.MetroColorStyle.Silver
Me.MetroButton4.TabIndex = 8
Me.MetroButton4.Text = "Save and Exit"
Me.MetroButton4.UseSelectable = True
'
'MetroToolTip1
'
Me.MetroToolTip1.Style = MetroFramework.MetroColorStyle.Blue
Me.MetroToolTip1.StyleManager = Nothing
Me.MetroToolTip1.Theme = MetroFramework.MetroThemeStyle.Light
'
'Config
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(444, 362)
Me.Controls.Add(Me.MetroButton4)
Me.Controls.Add(Me.MetroLabel9)
Me.Controls.Add(Me.PasswordBox)
Me.Controls.Add(Me.MetroPanel3)
Me.Controls.Add(Me.MetroPanel2)
Me.Controls.Add(Me.MetroPanel1)
Me.Name = "Config"
Me.Resizable = False
Me.Style = MetroFramework.MetroColorStyle.Purple
Me.Text = "Configuration"
Me.MetroPanel1.ResumeLayout(False)
Me.MetroPanel1.PerformLayout()
Me.MetroPanel2.ResumeLayout(False)
Me.MetroPanel2.PerformLayout()
Me.MetroPanel3.ResumeLayout(False)
Me.MetroPanel3.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents TTime As MetroFramework.Controls.MetroTextBox
Friend WithEvents MetroLabel1 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroLabel2 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroPanel1 As MetroFramework.Controls.MetroPanel
Friend WithEvents MetroLabel3 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroPanel2 As MetroFramework.Controls.MetroPanel
Friend WithEvents MetroLabel4 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroLabel5 As MetroFramework.Controls.MetroLabel
Friend WithEvents BlackoutFrom As MetroFramework.Controls.MetroComboBox
Friend WithEvents BlackoutTo As MetroFramework.Controls.MetroComboBox
Friend WithEvents MetroLabel6 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroPanel3 As MetroFramework.Controls.MetroPanel
Friend WithEvents MetroLabel7 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroButton2 As MetroFramework.Controls.MetroButton
Friend WithEvents MetroButton1 As MetroFramework.Controls.MetroButton
Friend WithEvents MetroLabel8 As MetroFramework.Controls.MetroLabel
Friend WithEvents MinBox As MetroFramework.Controls.MetroTextBox
Friend WithEvents MetroButton3 As MetroFramework.Controls.MetroButton
Friend WithEvents PasswordBox As MetroFramework.Controls.MetroTextBox
Friend WithEvents MetroLabel9 As MetroFramework.Controls.MetroLabel
Friend WithEvents MetroButton4 As MetroFramework.Controls.MetroButton
Friend WithEvents MetroToolTip1 As MetroFramework.Components.MetroToolTip
End Class
Line 259 is this:
Me.MetroButton3.UseSelectable = True
This also happened to another form in the same project. Any ideas what could be causing this?
This is similar to another question. Anyway, comment out the line in question. The example above has “The designer cannot process the code at line 259” so comment out line 259. Then open the file in the designer view. You'll want to look at why that line is causing the error in the first place and/or if commenting it out causes new problems. Check if it was “manually modified” as the error message suggests.