|
1 openfiledialog控件的使用
所使用的控件 RichTextBox Button(2个) openfiledialog
Button1.Text="打开文件" Button2.Text="退出"
代码如下:
Form_Load()
with openfiledialog1
.checkfileexists=true
.multiselect=false
.filter="文件类型(*.txt)|*.txt"
.InitialDirectory="c:\"
.showreadonly=true
.showhelp=true
.ReadOnlyChecked=True
end with
Button1_click()
if (openfiledialog1.showdialog=dialogresult.ok) and (openfiledialog1.filename.length>0) then
richetextbox1.loadfile(openfiledialog1.filename)
end if
if openfiledialog1.ReadOnlyChecked=true then
richtextbox1.readonly=true
else
richtextbox1.readonly=false
endif
sub button2.click()
me.close()
end sub
要求:1 调试上述代码
2 给出注释
3 不许粘贴复制 |
|