红色部分是原来代码
卷宗入库_Table1 对应卷宗入库
卷宗入库_Table2 对应入库明细
下述代码运行后提示错误为:
.NET Framework 版本:2.0.50727.8762
Foxtable 版本:2018.3.9.1
错误所在事件:窗口,卷宗入库,Button3,Click
详细错误信息:
未将对象引用设置到对象的实例。
If Tables("卷宗入库_Table1").Current IsNot Nothing Then
Tables("卷宗入库_Table2").Filter = "卷宗编号 = '" & Tables("卷宗入库_Table1").Current("卷宗编号") & "'"
If Tables("卷宗入库").Current IsNot Nothing Then
Tables("入库明细").Filter = "卷宗编号 = '" & Tables("卷宗入库").Current("卷宗编号") & "'"
Dim doc As New PrintDoc
Dim rg As prt.RenderGraphics
Dim Bar As New BarCodeBuilder
Dim dr As Row=Tables("打印机").Current
doc.PageSetting.Width = val(dr("设置宽度"))
doc.PageSetting.Height = val(dr("设置高度") )
doc.PageSetting.LeftMargin=val(dr("左边距") )
doc.PageSetting.RightMargin=val(dr("右边距") )
doc.PageSetting.TopMargin=val(dr("上边距") )
doc.PageSetting.BottomMargin=val(dr("下边距") )
Doc.PrinterName = dr("打印机名称")
'Dim xz As String = dr("是否旋转")
doc.AutoRotate = dr("是否旋转")
doc.PageSetting.Landscape=dr("是否横向")
Bar.Symbology = Barpro.Symbology.QRCode
Doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight
For Each r As Row In Tables("卷宗入库_Table2").Rows
For Each r As Row In Tables(入库明细").Rows
bar.Text=r("分册编号") & "册"
bar.Code = r("加密字符")
rg = new prt.RenderGraphics
bar.DrawOnCanvas(rg.Graphics,0,0, val(dr("缩放比例") ))
rg.Style.Spacing.All = 1
Doc.Body.Children.Add(rg)
bar.SaveImage(ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg")
r("二维码")=ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg"
'r.DataRow.SQLInsertFile("图片",ProjectPath & "Reports\卷宗二维码\" & r("卷宗编号") & r("分册编号") & "二维码.jpg")
'r.Save
'If r("图片") IsNot Nothing Then
'If FileSys.FileExists(ProjectPath & "Reports\" & r("卷宗编号") & r("分册编号") & "二维码.jpg") Then '如果指定的文件存在
'FileSys.DeleteFile(ProjectPath & "Reports\" & r("卷宗编号") & r("分册编号") & "二维码.jpg",2,2) '则彻底删除之
'End If
'End If
Next
Dim r1 As WinForm.RadioButton = e.Form.Controls("RadioButton1")
Dim r2 As WinForm.RadioButton = e.Form.Controls("RadioButton2")
If r1.Checked=True Then
Doc.Preview()
Else
If r2.Checked=True Then
Doc.Print()
Else
MessageBox.Show("请选择预览或者直打!")
End If
End If
End If
[此贴子已经被作者于2018/3/13 11:54:57编辑过]