|
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 |
|