If Tables("支piao").Rows.Count>0 Then
If Tables("支piao").Current.DataRow.RowState <> DataRowState.Unchanged Then '如果当前行已经修改过
MessageBox.Show("请先保存单据后打印!","温馨提示",MessageBoxButtons.OK,MessageBoxIcon.Information)
Return
Else
Dim r As Row = Tables("支piao").Current
Dim r1 As String = r("内码")
With Tables("支piao_pconf")
Dim a As Integer
a=.FindRow("[内码]='" & r1 & "'",.position+1,True)
If a>=0 Then '找到
Tables("支piao_pconf").Position=a
Dim prt As Row = Tables("支piao_pconf").Current
Dim pyz As Integer = prt("偏移_左") '取左偏移的值....
Dim pys As Integer = prt("偏移_上") '取上偏移的值....
Dim doc As New PrintDoc '定义一个报表
Dim text As new prt.RenderText
Dim dycs As DataRow = DataTables("系统设置").find("列名 = '默认打印机'")'判断默认打印机
If dycs("列值") = "" Then
MessageBox.Show("未设置默认打印,请在稍后弹出的窗口中选择默认打印机","提示信息")
Forms("系统设置").open
Else
Doc.PrinterName= dycs("列值")
End If
Doc.PageSetting.LeftMargin=1
Doc.PageSetting.BottomMargin =1
Doc.PageSetting.TopMargin=1
Doc.PageSetting.LeftMargin =1
doc.PageSetting.Width = val(prt("长度"))
doc.PageSetting.Height = val(prt("宽度"))
.........
Dim ytz As New prt.RenderText '用途左边
ytz.Text = r("用途")
ytz.X = val(prt("副_用途_X")) + pyz
ytz.y = val(prt("副_用途_Y")) + pys
Doc.body.Children.Add(ytz)
Doc.Preview()
这是代码 不知道能不能看出来什么问题。