在vb中可以实现自动出题吗。题目在access中包括选择,填空两个文件.谢谢

解决方案 »

  1.   

    当然能了
    不过我没做过
    ASP.net作过很简单的,用随机数抽取就行拉
      

  2.   

    可以的,我的毕业设计就试卷生成系统,题目中应该有公式和图片,可是我现在只能处理文字,出一般的填空和选择题没问题.离答辩只有20天了,只能放弃公式和图片了.先设定各章的难度,再从数据库中随机选题(根据难度),然后输出到word,最后打印(利用word的打印功能),在vb中打印要编很长的代码.
    输出到word要调用microsoft word 10.0 object library 在菜单上,工程--引用,在弹出的窗口上找到microsoft word 10.0 object library 打上钩,然后确定.
    下面给出主要的出题原码:(前提是连接好数据库)
    Option Explicit
    Dim fld As New Word.Application  'word对象
    Dim doc As Document '文档子对象
    Dim duan As Paragraph '段落子子对象Private Sub Command1_Click()
    Set doc = lxn.Documents().Add '新建文档
    Set duan = doc.Paragraphs().Add '新添一段
    duan.Range.InsertParagraphAfter tk.Fields(1)  'tk为一记录集,把当前记录的字段1(题                          '目)放入段中
    duan.Range.InsertParagraphAfter '差入空行,用于答题
    doc.SaveAs "c:\abcd.doc" '保存文档
    lxn.Quit '这句别丢,否则程序退出后,word仍在内存中,它会占大量内存
    End Sub
    下面的子程序用于选题:
    Sub xuanti()
    Randomize
    num = Int(sjsc.RecordCount * Rnd)
    sjsc.Move num
    duan.Range.InsertAfter sjsc.Fields(3)
    duan.Range.InsertParagraphAfter
    duan.Range.InsertParagraphAfter
    duan.Range.InsertParagraphAfter
    sjsc.Close
    End Sub