新人求教!对非共享成员的引用要求对象引用的问题
main页面代码没有问题,运行时提示对非共享成员的引用要求对象引用这里不是windoes窗体设计器生成的代码吗,为什么会错误?
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class main
Inherits System.Windows.Forms.Form
'Form 重写 Dispose,以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
system提示对非共享成员的引用要求对象引用 --------------------编程问答-------------------- 你是不是在窗体中定义了同名的变量。 --------------------编程问答-------------------- MyBase从哪里来的? --------------------编程问答--------------------
知道了,vb.net中的特有语法
vb.net是大小写敏感的吗?components 应该是Components
确定异常出现在贴出的代码中吗? --------------------编程问答--------------------
这个不是我自己定义的,调试的时候报错
--------------------编程问答--------------------
vb.net大小写不敏感 --------------------编程问答-------------------- 这些代码是在main.designer.vb里出现的<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class main
Inherits System.Windows.Forms.Form
'Form 重写 Dispose,以清理组件列表。
<System.Diagnostics.DebuggerNonUserCode()> _ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改它。
'不要使用代码编辑器修改它。
<System.Diagnostics.DebuggerStepThrough()> _ Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(main))
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip
Me.system = New System.Windows.Forms.ToolStripMenuItem
Me.user = New System.Windows.Forms.ToolStripMenuItem
再下面就是我在设计器里添加的工具栏之类的东西
红色那里的system调试时提示对非共享成员的引用要求对象引用
补充:.NET技术 , VB.NET