vb.net 设计者无法在行(行)处处理代码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/31506265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
The designer cannot process the code at line (line)
提问by dylanpdx
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:
我正在处理一个 VB.net 项目,有一次,由于此错误,我无法编辑任何表单的设计:
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.
设计者无法处理第 259 行的代码,详情请参阅任务列表。方法“InitializeComponent”中的代码由设计者生成,不应手动修改。请删除所有更改并再次尝试打开设计器。
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.
删除它并用原始 System.Windows.Forms.Form 替换它并没有解决问题。
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:
第 259 行是这样的:
Me.MetroButton3.UseSelectable = True
This also happened to another form in the same project. Any ideas what could be causing this?
这也发生在同一个项目中的另一个表单上。任何想法可能导致这种情况?
采纳答案by Crazy Cat
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.
这类似于另一个问题。无论如何,注释掉有问题的行。上面的例子有“设计器无法处理第 259 行的代码”,所以注释掉第 259 行。然后在设计器视图中打开文件。您首先需要查看为什么该行导致错误和/或注释掉它是否会导致新问题。检查它是否如错误消息所示“手动修改”。
回答by PooriaTheDebugger
i had the same Problem and i solved this with Downloading the 600 MB Visual Studio 2012 (which i used for my Projects before) and works perfect! This new Visual Studio 2015 is messed up and seems Buggy, so download the full express Version (i got the iso file and unpack with winrar and installed) Problem solved, i got the Problem on 4 mashines, now all work with my older codes :-) Peace Babas
我遇到了同样的问题,我通过下载 600 MB Visual Studio 2012(我以前用于我的项目)解决了这个问题,并且工作完美!这个新的 Visual Studio 2015 搞砸了,看起来像 Buggy,所以下载完整的 express 版本(我得到了 iso 文件并用 winrar 解压并安装)问题解决了,我在 4 个 mashine 上遇到了问题,现在都可以使用我的旧代码: -) 和平巴巴斯

