我是改了红色代码后出错的,原来的Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
效果出来是35楼效果,于是我改用获取位置,就出现上面的提示了,请教应怎么改?
Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
If e.Form.Controls("TextBox4").Value Is Nothing OrElse e.Form.Controls("TextBox5").Value Is Nothing Then
messagebox.show("模板长宽不能为空")
Return
End If
If e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(0) Then
doc.PageSetting.Width = 297 'A3纸张宽度,单位为毫米
doc.PageSetting.Height = 420 'A3纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(1) Then
doc.PageSetting.Width = 210 'A4纸张宽度,单位为毫米
doc.PageSetting.Height = 297 'A4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(2) Then
doc.PageSetting.Width = 148.5 'A5纸张宽度,单位为毫米
doc.PageSetting.Height = 210 'A5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(3) Then
doc.PageSetting.Width = 257 'B4纸张宽度,单位为毫米
doc.PageSetting.Height = 364 'B4纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(4) Then
doc.PageSetting.Width = 176 'B5纸张宽度,单位为毫米
doc.PageSetting.Height = 250 'B5纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(5) Then
doc.PageSetting.Width = 420 'A2纸张宽度,单位为毫米
doc.PageSetting.Height = 594 'A2纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton2").Checked = True And e.Form.Controls("ComboBox1").text = e.form.controls("combobox1").items(6) Then
doc.PageSetting.Width = 105 'A6纸张宽度,单位为毫米
doc.PageSetting.Height = 148 'A6纸张高度,单位为毫米
ElseIf e.Form.Controls("RadioButton1").Checked = True And e.Form.Controls("TextBox1").text IsNot Nothing And e.Form.Controls("TextBox2").text IsNot Nothing Then
doc.PageSetting.Width = Val(e.Form.Controls("TextBox2").Value) '自定义纸张宽度,单位为毫米
doc.PageSetting.Height = Val(e.Form.Controls("TextBox1").Value) '自定义纸张高度,单位为毫米
Else
messagebox.show("纸张规格不能为空")
Return
End If
If e.Form.Controls("ComboBox2").Value Is Nothing Then
messagebox.show("棋赛名称不能为空")
Return
End If
Dim c1 As Double = e.Form.Controls("TextBox4").Value
Dim c2 As Double = e.Form.Controls("TextBox5").Value
Dim c3 As Double = Val(doc.PageSetting.Width)
Dim c4 As Double = Val(doc.PageSetting.Height)
Doc.PageSetting.LeftMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置左边距
Doc.PageSetting.RightMargin = (c3 - c1*(Math.Floor(c3/c1)))/2 '设置右边距
Doc.PageSetting.TopMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置上边距
Doc.PageSetting.BottomMargin = (c4 - c2*(Math.Floor(c4/c2)))/2 '设置下边距
For i As Integer = 0 To DataTables("基本信息").SQLCompute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'") - 1
Dim rt As New prt.RenderTable() '定义一个表格对象
Dim drs As List(Of DataRow) = DataTables("基本信息").Select("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")