| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2168 人关注过本帖, 1 人收藏
标题:grid中如何自动计算
只看楼主 加入收藏
千分之
Rank: 2
等 级:论坛游民
帖 子:28
专家分:17
注 册:2015-5-16
收藏
得分:0 
学习
2015-05-16 12:52
ILoveVFD
Rank: 3Rank: 3
等 级:论坛游侠
威 望:3
帖 子:218
专家分:147
注 册:2015-5-2
收藏
得分:0 
是不是对初学者来说,这样作业太难了?
2015-05-16 21:01
TonyDeng
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:贵宾
威 望:304
帖 子:25859
专家分:48889
注 册:2011-6-22
收藏
得分:0 
樓主這個問題還沒有解決?

授人以渔,不授人以鱼。
2015-05-21 16:07
chychychy
Rank: 2
等 级:论坛游民
帖 子:214
专家分:91
注 册:2015-4-18
收藏
得分:0 
已解决,谢谢。正在学习其他的,不明白再请教。
2015-05-22 10:05
wangzhiyi
Rank: 7Rank: 7Rank: 7
等 级:贵宾
威 望:34
帖 子:366
专家分:684
注 册:2014-4-9
收藏
得分:0 
以下是引用TonyDeng在2015-5-16 11:29:26的发言:

他的代码写在Column9.Text1.LostFocus事件中,你自己改就是了,我不知道他的变量意义和处理逻辑是什么。


    Na=this.Value
    IF  na<0
      MESSAGEBOX('结果不可能为负的!',0+16,'是不是输入错误了?')
    endif

   
if na<=0
  repl cjp with 0
endif   

&&女生组判分   
   
if na>0 and na<=3.24 and 场次='B'
  repl cjp with 100
endif   

if na>3.24 and na<=3.27 and 场次='B'
  repl cjp with 98
endif   

if na>3.27 and na<=3.29 and 场次='B'
  repl cjp with 96
endif   

if na>3.29 and na<=3.32 and 场次='B'
  repl cjp with 94
endif   

if na>3.32 and na<=3.35 and 场次='B'
  repl cjp with 92
endif   

if na>3.35 and na<=3.38 and 场次='B'
  repl cjp with 90
endif   

if na>3.38 and na<=3.42 and 场次='B'
  repl cjp with 87
endif   

if na>3.42 and na<=3.46 and 场次='B'
  repl cjp with 84
endif   

if na>3.46 and na<=3.50 and 场次='B'
  repl cjp with 81
endif   

if na>3.50 and na<=3.54 and 场次='B'
  repl cjp with 78
endif   

if na>3.54 and na<=3.58 and 场次='B'
  repl cjp with 75
endif   

if na>3.58 and na<=4.03 and 场次='B'
  repl cjp with 72
endif   

if na>4.03 and na<=4.08 and 场次='B'
  repl cjp with 69
endif   

if na>4.08 and na<=4.13 and 场次='B'
  repl cjp with 66
endif   

if na>4.13 and na<=4.18 and 场次='B'
  repl cjp with 63
endif   

if na>4.18 and na<=4.23 and 场次='B'
  repl cjp with 60
endif   

if na>4.23 and na<=4.30 and 场次='B'
  repl cjp with 50
endif   


if na>4.30 and na<=4.37 and 场次='B'
  repl cjp with 40
endif   


if na>4.37 and na<=4.44 and 场次='B'
  repl cjp with 30
endif   


if na>4.44 and na<=4.51 and 场次='B'
  repl cjp with 20
endif   


if na>4.51 and 场次='B'
  repl cjp with 10
endif   

&&男生组判分   
   
if na>0 and na<=3.30 and 场次='A'
  repl cjp with 100
endif   

if na>3.30 and na<=3.36 and 场次='A'
  repl cjp with 98
endif   

if na>3.36 and na<=3.38 and 场次='A'
  repl cjp with 96
endif   

if na>3.38 and na<=3.42 and 场次='A'
  repl cjp with 94
endif   

if na>3.42 and na<=3.46 and 场次='A'
  repl cjp with 92
endif   

if na>3.46 and na<=3.50 and 场次='A'
  repl cjp with 90
endif   

if na>3.50 and na<=3.54 and 场次='A'
  repl cjp with 87
endif   

if na>3.54 and na<=3.58 and 场次='A'
  repl cjp with 84
endif   

if na>3.58 and na<=4.02 and 场次='A'
  repl cjp with 81
endif   

if na>4.02 and na<=4.06 and 场次='A'
  repl cjp with 78
endif   

if na>4.06 and na<=4.10 and 场次='A'
  repl cjp with 75
endif   

if na>4.10 and na<=4.15 and 场次='A'
  repl cjp with 72
endif   

if na>4.15 and na<=4.20 and 场次='A'
  repl cjp with 69
endif   

if na>4.20 and na<=4.25 and 场次='A'
  repl cjp with 66
endif   

if na>4.25 and na<=4.30 and 场次='A'
  repl cjp with 63
endif   

if na>4.30 and na<=4.35 and 场次='A'
  repl cjp with 60
endif   

if na>4.35 and na<=4.45 and 场次='A'
  repl cjp with 50
endif   


if na>4.45 and na<=4.55 and 场次='A'
  repl cjp with 40
endif   


if na>4.55 and na<=5.05 and 场次='A'
  repl cjp with 30
endif   


if na>5.05 and na<=5.15 and 场次='A'
  repl cjp with 20
endif   


if na>5.15 and 场次='A'
  repl cjp with 10
endif   


&&计算总分和折算分数
   
rEPLACE cjtc WITH cjp*0.3+cjq*0.2
rEPLACE zscj WITH cjtc*0.5

一个简单问题这么长的代码,真是简单分支的专家。路过
2015-05-22 17:19
yndzx
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2015-6-3
收藏
得分:0 
grid中如何自动计算
表格控件中输入某一值(如跑成绩:1000米跑的时间),另一列(跑得分)自动计算得分,如3.25分钟内为100分,3.26-4分钟为90分。如图
在grid的column*(即跑步成绩列).text1对象的LostFocus过程中输入如下代码:
sele (表别名)
if 跑步成绩列(字段名)<3.25
   repl 跑得分列(字段名) with 100
endif
if 跑步成绩列(字段名)>=3.26 and 跑步成绩列(字段名)<4
   repl 跑得分列(字段名) with 90
endif
   
2015-06-03 17:27
muyubo
Rank: 9Rank: 9Rank: 9
来 自:山东莱芜
等 级:蜘蛛侠
威 望:3
帖 子:471
专家分:1017
注 册:2011-3-6
收藏
得分:0 
回复 36楼 yndzx
中学体育田径成绩有得分计算对照表,不单纯是90,100分,还有男、女、小学、甲、乙组之分,应该把这些数据做成表,然后编程查表。
2015-06-03 17:39
muyubo
Rank: 9Rank: 9Rank: 9
来 自:山东莱芜
等 级:蜘蛛侠
威 望:3
帖 子:471
专家分:1017
注 册:2011-3-6
收藏
得分:0 
多年以前,我想用dos fox做,后来,本校的体育组老头不太感兴趣,也就算了。
其实挺简单,能马上得出分数,不然的话,他们得组织很多人,人工查表填成绩,很慢很麻烦。要知道,中学在校生8-9千人那。
2015-06-03 17:48
chychychy
Rank: 2
等 级:论坛游民
帖 子:214
专家分:91
注 册:2015-4-18
收藏
得分:0 
是的,举一反三吗!我很早以前用dos fox编过小的应用,后来用excel,几乎把fox忘光了,现在用视窗下的等于重新学习了。以后多向你请教。
2015-06-03 21:09
zhonglong
Rank: 1
等 级:新手上路
帖 子:5
专家分:0
注 册:2015-6-3
收藏
得分:0 
把这段代码写在跑成绩列的TEXT1.valid事件里
2015-06-03 21:35
快速回复:grid中如何自动计算
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012219 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved