如何用表单设计一个考试系统的单项选择题,将用户提交的答案放在文本框中(答案要实现刷新功能,防止统计出错),并且在最后与正确答案比较,统计出分数?
后面怎么做呀
谢谢大家了
已经设计好单项选择的代码如下
form1.init
use 考试题
thisform.label1.caption=试题名
thisform.optiongroup1.option1.caption=选项1
thisform.optiongroup1.option2.caption=选项2
thisform.optiongroup1.option3.caption=选项3
thisform.optiongroup1.option4.caption=选项4
thisform.optiongroup1.value=0
form1.load
public pp(20),aa(20)
pp=0
aa=""
optiongroup.click &&单项选择题
pp(recno())=thisform.optiongroup1.value
if pp(recno())=答案编号
thisform.label2.caption="√"
else
thisform.label2.caption="×"
endif
aa(recno())=thisform.label2.caption
command1.click &&下一题按钮
skip
if not eof() thisform.command1.enabled=.t.
thisform.optiongroup1.value=pp(recno())
thisform.label1.caption=试题名
thisform.optiongroup1.option1.caption=选项1
thisform.optiongroup1.option2.caption=选项2
thisform.optiongroup1.option3.caption=选项3
thisform.optiongroup1.option4.caption=选项4
thisform.label2.caption=aa(recno())
else
skip -1
thisform.command1.enabled=.f.
endif
thisform.command2.enabled=.t.
skip -1
if not bof()
thisform.command2.enabled=.t.
thisform.label2.caption=aa(recno())
thisform.optiongroup1.value=pp(recno())
thisform.label1.caption=试题名
thisform.optiongroup1.option1.caption=选项1
thisform.optiongroup1.option2.caption=选项2
thisform.optiongroup1.option3.caption=选项3
thisform.optiongroup1.option4.caption=选项4
command2.click &&上一题按钮
skip -1
if not bof() thisform.command2.enabled=.t.
thisform.label2.caption=aa(recno())
thisform.optiongroup1.value=pp(recno())
thisform.label1.caption=试题名
thisform.optiongroup1.option1.caption=选项1
thisform.optiongroup1.option2.caption=选项2
thisform.optiongroup1.option3.caption=选项3
thisform.optiongroup1.option4.caption=选项4
[此贴子已经被作者于2006-6-28 23:46:07编辑过]