Foxtable(狐表)用户栏目专家坐堂 → 窗口中按钮代码错误提示


  共有1570人关注过本帖平板打印复制链接

主题:窗口中按钮代码错误提示

美女呀,离线,留言给我吧!
东方电子威斯顿
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:婴狐 帖子:22 积分:227 威望:0 精华:0 注册:2016/12/13 9:21:00
窗口中按钮代码错误提示  发帖心情 Post By:2016/12/28 14:41:00 [只看该作者]

各位老师好:这个项目中遇到的问题有以下2个:
1.窗口查找按钮的只能显示一个材料代号,怎么样把所有相同名称的材料代号一块显示?
2.导出检验记录按钮一直提示错误,请老师帮忙查看是哪里出错了?谢谢
查找按钮代码:
Dim tbx As WinForm.TextBox = e.Form.Controls("txtFind")
Dim str As String =tbx.value
Dim dr As DataRow=DataTables("电池").Find("材料代号='" & str & "'")
If dr IsNot Nothing Then
    Dim idx As Integer = Tables("电池").findrow(dr)
    If idx>=0 Then
        Tables("电池").Position=idx
    End If
End If
导出按钮代码:
If Tables("电池").Current Is Nothing Then Return
Dim count As Integer = Tables("电池").Current("零缺陷数量")
Dim count1 As Integer =10
Dim Book As New XLS.Book(ProjectPath & "Attachments\电池检验记录.xls") '打开模板
Dim fl As String = ProjectPath & "Reports\电池检验记录.xls"
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Dim nums1 As new List(Of String)
Dim nums2 As new List(Of String)
Dim nums3 As new List(Of String)
For Each dr As DataRow In DataTables("电池检验记录").Select("空载电压测试值 is not null")
    nums1.Add(dr("空载电压测试值"))
    nums2.add(dr("外形尺寸_本体长度"))
    nums3.add(dr("外形尺寸_本体直径"))
Next
For i As Integer = 1 To 30
If i > count Then Exit For
    sheet(62+i, 2).value = nums1(Rand.Next(count))
    Next
For i As Integer = 31 To 60
    If i > count Then Exit For
    sheet(32+i, 7).value = nums1(Rand.Next(count))
Next
For i As Integer = 61 To 90
    If i > count Then Exit For
    sheet(62+i, 14).value = nums1(Rand.Next(count))
Next
For i As Integer = 91 To 120
    If i > count Then Exit For
    sheet(32+i, 21).value = nums1(Rand.Next(count))
Next
For s As Integer =0 To 5
    sheet(56,6+4*s).value = nums2(Rand.Next(count))
    sheet(57,6+4*s).value = nums3(Rand.Next(count))
Next
For s As Integer = 6 To 10
    sheet(59,2+4*(s-5)).value = nums2(Rand.Next(count))
    sheet(60,2+4*(s-5)).value = nums3(Rand.Next(count))
Next
Book.Build() '生成报表
Book.Save(fl)
'book.save(dfile)

Dim proc As new Process
proc.File = fl
proc.Start

 回到顶部