查看: 3586|回复: 0

实训2

[复制链接]
发表于 2008-4-25 09:05:53 | 显示全部楼层 |阅读模式
2 savefiledialog练习
  需要的控件:savefiledialog button3 button4
button3.text="保存" button4.text="另存为"
  提示:可以在上个例子的基础上继续做
  代码如下:
  声明全局变量:dim oldfile as string
sub button1_click()
   oldfile=me.openfiledialog1.filename
   me.richtextbox1.loadfile(oldfile)
sub button3_click()
   me.richtextbox1.save(oldfile)
sub button4_click()
  with savefiledialog1
      .addextension=true
      .defaultext="txt"
      .checkpathexists=jtrue
      .filter="txt(*.txt)|*.txt"
      .overwriteprompt=true
   end with
   if me.savefiledialog1.showdialog=dialogresult.ok and me.savefiledialog1.filename<>"" then
      oldfile=savefiledialog1.filename
      richtextbox1.save(oldfile)
   endif
end sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关注公众号
手机版|小黑屋|联系站长|帮助中心| 河北软件学院门户网

相关侵权、举报、投诉及建议等,请发 E-mail:kuns@126.com

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖
关注公众号
QQ客服返回顶部