我在尝试编译这段代码时遇到了这个问题
Public Class Form2
Dim db_classobj As Object
Dim textboxobj() As TextBox = {TextBox1, TextBox2}
Dim datagridobj() As DataGridView = {DataGridView1}
Dim temp As New db_class(textboxobj, datagridobj, "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=datamhs.accdb", "mhs", "ksmhs")
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
db_classobj = temp
End Sub
End Class
编译时,我收到此错误消息:
创建表单时出错。有关详细信息,请参阅 Exception.InnerException。错误是:对象引用未设置为对象的实例。
我的代码有什么问题?有人可以解决吗?对此,我真的非常感激。谢谢。