Dim dlg As New OpenFileDialog
dlg.Filter= "Excel 97-2003文件(*.xls)|*.xls|Excel 2007文件(*.xlsx)|*.xlsx"
If dlg.ShowDialog = DialogResult.Ok Then
Dim cmb1 As WinForm.ComboBox = e.Form.Controls("ComboBox1")
Dim txtb1 As WinForm.TextBox = e.Form.Controls("TextBox1")
txtb1.value = dlg.FileName
cmb1.Value = ""
If txtb1.Value > "" Then
Book = New XLS.Book(txtb1.value)
cmb1.items.clear
Dim str(Book.Sheets.count - 1) As String
Dim Sheet As XLS.Sheet
For i As Integer = 0 To Book.Sheets.count - 1
str(i) = Book.Sheets(i).name ' str.add(Book.Sheets(i).name)
Next
cmb1.Items.AddRange(str)
End If
cmb1.Select()
End If
有密码时出错:
.NET Framework 版本:2.0.50727.3655
Foxtable 版本:2014.11.11.1
错误所在事件:窗口,Excel导入,Button1,Click
详细错误信息:
Object reference not set to an instance of an object.