找回密码
 注册

扫一扫,访问微社区

查看: 3097|回复: 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
您需要登录后才可以回帖 登录 | 注册

本版积分规则

网络开发 全网营销 全案服务

QQ|手机版|小黑屋|联系站长|河北软件职业技术学院论坛

GMT+8, 2024-4-28 18:57

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表