Foxtable(狐表)用户栏目专家坐堂 → 点选下拉列表选项后,其他控件未定现自动录入数据


  共有2954人关注过本帖树形打印复制链接

主题:点选下拉列表选项后,其他控件未定现自动录入数据

帅哥哟,离线,有人找我吗?
有点蓝
  21楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 9:21:00 [只看该作者]

还是基础不牢。

e.Form.Controls("RadioButton1")表示的是一个控件,就是单选框本身,e.Form.Controls("RadioButton1")=true表示【单选框=true】是没有意义的。应该是单选框是否勾选的结果=true】:e.Form.Controls("RadioButton1").check=true。要使用一个控件,麻烦先把这个控件帮助过几遍,看看帮助里是什么用的。

另外e.Form.Controls("ComboBox1")也有同样问题

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  22楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 12:14:00 [只看该作者]

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
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 Then
    doc.PageSetting.Width = e.Form.Controls("TextBox1").Value '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = e.Form.Controls("TextBox2").Value  '自定义纸张高度,单位为毫米
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 = 1 To 100
    Dim rt As New prt.RenderTable() '定义一个表格对象
    Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
    Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
    If dr IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 6 '设置总行数
        rt.Cols.Count = 5 '设置总列数
        rt.Cols(0).Width = 20
        rt.cells(0,0).SpanCols = 5
        rt.cells(0,0).Text = e.Form.Controls("ComboBox2").text
        rt.Cells(1,0).SpanCols = 5
        If dr(i)("棋赛副名") = Nothing Then
            rt.Cells(1,0).Text = Nothing
        Else
            rt.Cells(1,0).Text = dr(i)("棋赛副名")
        End If
        rt.Cells(4,3).Text = dr(i)("编号")
        rt.cells(6,2).SpanCols = 3
        rt.Cells(6,2).Text= dr(i)("姓名")
    Else
        msgbox("没有符合条件的数据")
    End If
    doc.Body.Children.Add(rt) '将表格对象加入到报表中
Next
Doc.Preview() '预览报表

改这这样报错:
.NET Framework 版本:4.0.30319.18063
Foxtable 版本:2021.11.4.1
错误所在事件:窗口,胸牌排版,Button1,Click
详细错误信息:
Column '1' does not belong to table .

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  23楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 12:27:00 [只看该作者]

我要这样的效果

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211106122620.png
图片点击可在新窗口打开查看


 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  24楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 13:51:00 [只看该作者]

还是基础问题

Dim dr As DataRow表示一个数据行,不是多个数据行的集合,那么【dr(i)("棋赛副名")】又是什么神仙用法

SQLFind和SQLSelect的帮助先都看看吧

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  25楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 14:51:00 [只看该作者]

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
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 Then
    doc.PageSetting.Width = e.Form.Controls("TextBox1").Value '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = e.Form.Controls("TextBox2").Value  '自定义纸张高度,单位为毫米
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 '设置下边距
Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
For i As Integer = 1 To DataTables("基本信息").Compute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
    Dim rt As New prt.RenderTable() '定义一个表格对象
    Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
    If dr IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 6 '设置总行数
        rt.Cols.Count = 5 '设置总列数
        rt.Cols(0).Width = 20
        rt.cells(0,0).SpanCols = 5
        rt.cells(0,0).Text = e.Form.Controls("ComboBox2").text
        rt.Cells(1,0).SpanCols = 5
        If dr("棋赛副名") = Nothing Then
            rt.Cells(1,0).Text = Nothing
        Else
            rt.Cells(1,0).Text = dr("棋赛副名")
        End If
        rt.Cells(4,3).Text = dr("编号")
        rt.cells(6,2).SpanCols = 3
        rt.Cells(6,2).Text= dr("姓名")
    Else
        msgbox("没有符合条件的数据")
    End If
    doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Min0 = CStr(CInt(Max0) + 1)
Next
Doc.Preview() '预览报表

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211106145030.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2021/11/6 15:20:45编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  26楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 14:56:00 [只看该作者]

提示很明显了,不存在Max0这个变量:

Min0 = CStr(CInt(Max0) + 1)

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  27楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 15:01:00 [只看该作者]

上面不是已经定义了这个变量吗?
Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")

 回到顶部
帅哥哟,离线,有人找我吗?
有点蓝
  28楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:106067 积分:539428 威望:0 精华:9 注册:2015/6/24 9:21:00
  发帖心情 Post By:2021/11/6 15:15:00 [只看该作者]

睁大眼睛在看看呗,定义的是Min0 ,不是Max0

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  29楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 15:19:00 [只看该作者]

Dim doc As New PrintDoc '定义一个报表
doc.Stacking = prt.StackingRulesEnum.InlineLeftToRight '设置排列方式
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 Then
    doc.PageSetting.Width = e.Form.Controls("TextBox1").Value '自定义纸张宽度,单位为毫米
    doc.PageSetting.Height = e.Form.Controls("TextBox2").Value  '自定义纸张高度,单位为毫米
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 '设置下边距
Dim Min0 As String = DataTables("基本信息").SQLCompute("Min(编号)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
For i As Integer = 1 To DataTables("基本信息").Compute("Count(姓名)","[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "'")
    Dim rt As New prt.RenderTable() '定义一个表格对象
    Dim dr As DataRow = DataTables("基本信息").SQLFind("[棋赛名称] = '" & e.Form.Controls("ComboBox2").text & "' And [编号] = '" & Min0 & "'")
    If dr IsNot Nothing Then
        rt.Style.GridLines.All = New prt.LineDef '将网格线类型设为默认类型
        rt.Style.GridLines.Horz = new Prt.LineDef(Color.white)
        rt.Style.GridLines.Vert = new Prt.LineDef(Color.white)
        rt.Width = c1 '表格宽度为
        rt.Height = c2
        rt.Style.Spacing.All = 2 '和其他对象之间的间隔为2mm
        rt.SplitVertBehavior = prt.SplitBehaviorEnum.Never '避免垂直换页的时候,表格被分割成两部分.
        rt.Rows.Count = 8 '设置总行数
        rt.Cols.Count = 7 '设置总列数
        rt.Rows(0).Height = 7
        rt.Cols(0).Width = 3
        rt.cells(0,0).SpanCols = 7
        rt.cells(1,1).SpanCols = 5
        rt.Rows(1).Height = 10
        rt.Cells(1,1).Style.FontBold = True
        rt.Cells(1,1).Style.Font = New Font("华文楷体", 18, FontStyle.Bold)
        rt.cells(1,1).Text = e.Form.Controls("ComboBox2").text
        rt.cells(1,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(1,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Cells(2,1).SpanCols = 5
        rt.Rows(2).Height = 10
        If dr("棋赛副名") = Nothing Then
            rt.Cells(2,1).Text = Nothing
        Else
            rt.Cells(2,1).Text = dr("棋赛副名")
        End If
        rt.Cells(2,1).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(2,1).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(3).Height = 1
        rt.Cols(3).Width = 37
        rt.Rows(4).Height = 30
        rt.Cells(4,3).Text = dr("编号")
        rt.Cells(4,3).Style.Font = New Font("华文楷体", 72, FontStyle.Bold)
        rt.Cells(4,3).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(4,3).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.Rows(5).Height = 1
        rt.cells(6,2).SpanCols = 3
        rt.Cells(6,2).Text= dr("姓名")
        rt.Cells(6,2).Style.Font = New Font("华文楷体", 28, FontStyle.Bold)
        rt.Cells(6,2).Style.TextAlignHorz = prt.AlignHorzEnum.Center
        rt.cells(6,2).Style.TextAlignVert = prt.AlignHorzEnum.Center
        rt.cells(7,0).SpanCols = 7
        rt.Rows(7).Height = 7
        rt.Cols(6).Width = 3
    Else
        msgbox("没有符合条件的数据")
    End If
    doc.Body.Children.Add(rt) '将表格对象加入到报表中
    Min0 = CStr(CInt(Min0) + 1)
Next
Doc.Preview() '预览报表

可以了。
[此贴子已经被作者于2021/11/6 19:51:29编辑过]

 回到顶部
美女呀,离线,留言给我吧!
采菊东篱下
  30楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:八尾狐 帖子:1881 积分:10368 威望:0 精华:0 注册:2019/4/6 8:45:00
  发帖心情 Post By:2021/11/6 17:20:00 [只看该作者]

上面的代码已经做出这样的效果,我想把网格不显示,另能不能在棋赛名称旁加个按钮弹出系统自带的字体窗口,随意选字体、字号,不要系统的字体窗口什么字体多大看不到效果啊。

图片点击可在新窗口打开查看此主题相关图片如下:qq图片20211106171353.png
图片点击可在新窗口打开查看

[此贴子已经被作者于2021/11/6 17:22:30编辑过]

 回到顶部
总数 44 上一页 1 2 3 4 5 下一页