NullReferenceException vb.net
我收到一个错误,因为“对象引用未设置为对象的实例” 在代码的第三行。 可能的原因是什么NullReferenceException vb.net,.net,vb.net,nullreferenceexception,.net,Vb.net,Nullreferenceexception,我收到一个错误,因为“对象引用未设置为对象的实例” 在代码的第三行。 可能的原因是什么 Dim table As New DataTable() Me.bindingSource1.DataSource = table Me.bindingSource1 = DataGridView1.DataSource table = Me.bindingSource1.DataSource 我只需要知道可能的原因要么“Me”为null(VB中没有),要么DataGridView1为null。原因可能在代
Dim table As New DataTable()
Me.bindingSource1.DataSource = table
Me.bindingSource1 = DataGridView1.DataSource
table = Me.bindingSource1.DataSource
我只需要知道可能的原因要么“Me”为null(VB中没有),要么DataGridView1为null。原因可能在代码的其他地方。使用调试器查找。可能
DataGridView1
可能是nothing
,Me
没有问题,因为执行跨越了第二行,没有任何中断。检查DataGridView1
是否为空
- 在第3行设置一个断点
- 当
敲打时,按断点
(即时窗口)Ctrl+I
- 在其中键入
?DataGridView1
- 然后按ENTER键,您将发现它是否为nothing