按钮代码
Dim bookname As WinForm.TextBox = e.Form.Controls("bookName")
If bookname.Value = "" Then
MessageBox.show("请点击 [Excel文件] 按钮,选取Excel文件! ","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
Return
End If
Dim sheetname As WinForm.ComboBox = e.Form.Controls("sheetname")
If sheetname.SelectedValue = "" Then
MessageBox.show("导入工作表不能为空 ! ","错误提示",MessageBoxButtons.OK,MessageBoxIcon.Error)
Return
End If
Dim Book As New XLS.Book(bookname.text)
Dim sheet As XLS.Sheet = book.sheets(sheetname.SelectedValue)
Dim bt As WinForm.CheckBox = e.Form.Controls("标题")
'设定最大取值列
Dim maxc As WinForm.NumericComboBox = e.Form.Controls("最大列")
If maxc.value > sheet.Cols.Count Or maxc.value = 0 Then
maxc.Value = sheet.Cols.Count
End If
Dim qsh As WinForm.NumericComboBox = e.Form.Controls("有效起始行")
Dim cblst As String
'------遍历数据-----
Dim qs As Integer = cint(qsh.Text)
For r As Integer = qs-1 To qs+6
Dim lst As String = ""
For c As Integer = 0 To maxc.value - 1
Dim data As String = sheet(r,c).value
lst = lst & data.PadLeft(8," ") & ","
Next
cblst = cblst & lst & "|"
Next
'-----标题-----'
Dim h As String
Dim cbl As String = ""
For c As Integer = 0 To maxc.Value -1
h = "第" & cstr(c+1) & "列"
If bt.Checked Then
cbl = cbl & h & "-->" & sheet(qs-1,c).Text & "|"
Else
cbl = cbl & h & "|"
End If
Next
Dim lst5r As WinForm.ListBox = e.Form.Controls("lst5r")
lst5r.ComboList = cblst
e.Form.Controls("表字段0").combolist = cbl.TrimEnd("|")
'dcl.ComboList = cbl.TrimEnd("|")