以文本方式查看主题
- Foxtable(狐表) (http://foxtable.net/bbs/index.asp)
-- 专家坐堂 (http://foxtable.net/bbs/list.asp?boardid=2)
---- [求助]增加代码 (http://foxtable.net/bbs/dispbbs.asp?boardid=2&id=3393)
|
-- 作者:易服
-- 发布时间:2009/7/2 11:44:00
-- [求助]增加代码
此主题相关图片如下:打开.png
此主题相关图片如下:增加.png
想增加一段代码试了多次不成功,请大师指点:不选乡名统计到乡;选择乡名统计到村 以下代码是正确的 If ( e.Form.Controls("RadioButton1").Checked Or e.Form.Controls("RadioButton2").Checked Or e.Form.Controls("RadioButton3").Checked)= False Then Messagebox.Show("选一个项目") Return End If If ( e.Form.Controls("RadioButton4").Checked Or e.Form.Controls("RadioButton5").Checked )= False Then Messagebox.Show("选一个面积") Return End If Dim Filter As String With e.Form.Controls("ComboBox1") If .Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "乡名= \'" & .Value & "\'" End If End With Dim g As New CrossTableBuilder("交叉统计", DataTables("总览"),Filter) If e.Form.Controls("RadioButton1").Checked Then g.VGroups.AddDef("造林年度","{0}年_总面积") If e.Form.Controls("RadioButton2").Checked Then g.VGroups.AddDef("造林类别","{0}_总面积") If e.Form.Controls("RadioButton3").Checked Then g.VGroups.AddDef("林种","{0}_总面积") If e.Form.Controls("RadioButton4").Checked Then g.Totals.AddDef("保存面积","总面积") If e.Form.Controls("RadioButton5").Checked Then g.Totals.AddDef("退耕地","总面积") g.HGroups.AddDef("乡名") g.HorizontalTotal = True g.VerticalTotal = True g.HorizontalProportion = True g.VerticalProportion = True g.Build() MainTable = Tables("交叉统计")
[此贴子已经被作者于2009-7-2 16:19:32编辑过]
|
-- 作者:yangming
-- 发布时间:2009/7/2 11:55:00
--
发文件吧,便于测试
|
-- 作者:易服
-- 发布时间:2009/7/2 12:56:00
--
文件已发(一楼),烦劳写代码
[此贴子已经被作者于2009-7-2 12:56:17编辑过]
|
-- 作者:易服
-- 发布时间:2009/7/2 15:07:00
--
自己顶
|
-- 作者:yangming
-- 发布时间:2009/7/2 15:16:00
--
将一楼的红字行,改成
If cmb.Value IsNot Nothing Then g.HGroups.AddDef("村名") Else g.HGroups.AddDef("乡名") End If
|
-- 作者:易服
-- 发布时间:2009/7/2 15:23:00
--
谢谢 !通过测试吗? 1
|
-- 作者:yangming
-- 发布时间:2009/7/2 15:28:00
--
以下是引用易服在2009-7-2 15:23:00的发言: 谢谢 !通过测试吗? 1
不通过我也不会上传的,呵
If ( e.Form.Controls("RadioButton1").Checked Or e.Form.Controls("RadioButton2").Checked Or e.Form.Controls("RadioButton3").Checked)= False Then Messagebox.Show("选一个项目") Return End If If ( e.Form.Controls("RadioButton4").Checked Or e.Form.Controls("RadioButton5").Checked )= False Then Messagebox.Show("选一个面积") Return End If Dim Filter As String Dim cmb As WinForm.ComboBox=e.Form.Controls("ComboBox1") If cmb.Value IsNot Nothing Then If Filter > "" Then Filter = Filter & " And " End If Filter = Filter & "乡名= \'" & cmb.Value & "\'" End If Dim g As New CrossTableBuilder("交叉统计", DataTables("总览"),Filter) If e.Form.Controls("RadioButton1").Checked Then g.VGroups.AddDef("造林年度","{0}年_总面积") If e.Form.Controls("RadioButton2").Checked Then g.VGroups.AddDef("造林类别","{0}_总面积") If e.Form.Controls("RadioButton3").Checked Then g.VGroups.AddDef("林种","{0}_总面积") If e.Form.Controls("RadioButton4").Checked Then g.Totals.AddDef("保存面积","总面积") If e.Form.Controls("RadioButton5").Checked Then g.Totals.AddDef("退耕地","总面积") If cmb.Value IsNot Nothing Then g.HGroups.AddDef("村名") Else g.HGroups.AddDef("乡名") End If g.HorizontalTotal = True g.VerticalTotal = True g.HorizontalProportion = True g.VerticalProportion = True g.Build() MainTable = Tables("交叉统计")
[此贴子已经被作者于2009-7-2 15:30:38编辑过]
|