我有一个 vb.net windows 表单,当表单打开时,它没有触发表单加载处理程序。这发生在我手动编辑 Designer.vb 文件以添加一些新字段之后。我已经查看了一个类似的问题,但是在尝试了该问题建议答案中的所有解决方案后,它没有显示表单可能隐藏的任何隐藏错误。
有些事情需要注意,其他事件似乎正在正确触发,例如 Me.FormClosed 或 Me.FormClosing。
Form_Load 事件示例代码:
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Catch ex As Exception
End Try
End Sub
我对 Designer.vb 文件所做的更改示例:
添加
Private Sub InitializeComponent()
Me.TextBox100 = New System.Windows.Forms.TextBox()
'
'TextBox100
'
Me.TextBox100.BackColor = System.Drawing.Color.Honeydew
Me.TextBox100.DataBindings.Add(New System.Windows.Forms.Binding("Text", Me.SomethingBindingSource, "NAME", True))
Me.TextBox100.Dock = System.Windows.Forms.DockStyle.Fill
Me.TextBox100.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TextBox100.Location = New System.Drawing.Point(414, 118)
Me.TextBox100.Margin = New System.Windows.Forms.Padding(0)
Me.TextBox100.Name = "TextBox100"
Me.TextBox100.Size = New System.Drawing.Size(134, 22)
Me.TextBox100.TabIndex = 47
Me.TextBox100.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
End Sub
Friend WithEvents TextBox100 As System.Windows.Forms.TextBox
任何建议都会非常有帮助,谢谢