Foxtable(狐表)用户栏目专家坐堂 → 未将对象引用设置到对象的实例


  共有2104人关注过本帖树形打印复制链接

主题:未将对象引用设置到对象的实例

帅哥哟,离线,有人找我吗?
刘林
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1953 积分:15015 威望:0 精华:0 注册:2016/4/28 9:58:00
未将对象引用设置到对象的实例  发帖心情 Post By:2016/10/12 14:04:00 [显示全部帖子]

 老师,下面代码出现:未将对象引用设置到对象的实例,请问什么原因,怎么办,谢谢

Dim dlg As new OpenFileDialog
dlg.Filter = "Excel|*.xls;*.xlsx"
If dlg.ShowDialog = DialogResult.OK Then
    Dim Book As New XLS.Book(dlg.FileName)
    Dim Sheet As XLS.Sheet = Book.Sheets(0)
    Tables("上分_table1").StopRedraw()
    Dim mc As String = sheet(0,1).value
    Dim dm As String = sheet(1,1).value
    Dim bj As String = sheet(2,1).value
    Dim ksmc As String = sheet(3,1).value
    Dim kmA As String = sheet(4,1).value & "_A"
    Dim kmB As String = sheet(4,1).value & "_B"

    For n As Integer = 5 To Sheet.Rows.Count -1
        Dim kh As String = sheet(n+1,0).value
        Dim dr As DataRow = DataTables("成绩").Find("班级 = '" & bj & "'and 单位名称 = '" & mc & "' and 年级代码 = '" & dm & "'and 考试名称 = '" & ksmc & "' and 考号= '" & kh & "'")
        dr(kmA) = sheet(n+1,2).value
        dr(kmB) = sheet(n+1,3).value
    Next
Tables("上分_table1").ResumeRedraw()
End If

 回到顶部