.NET自由天空
Would you like to react to this message? Create an account in a few clicks or log in to continue.

system.io 实训要求

向下

system.io 实训要求 Empty system.io 实训要求

帖子  Admin 周五 四月 18, 2008 9:20 am

1.熟悉system.io名称空间中各种亚类的使用,对照File类、Fileinfo类与Directory类、Directoryinfo类的不同使用方法。
2.练习下列操作:
步骤1:创建新项目
步骤2:从[工具箱]中拖出一个TextBox控件、一个Button控件,设置TextBox的name属性为txtfile,Multiline属性为True; Button的text属性为“ 读取";一个label控件
步骤3:填写如下代码:
function getiniinfo(inifile) then
if not file.exists(inifile) then
label1.text="文件"&inifile&"未找到"
end if
dim inread as new streamreader(inifile)
dim inistr as string=iniread.readtoend
dim i as integer
dim cline as integer
dim nosec as boolean=false
dim getvalue as string=""
dim clst
clst=inistr.split(chr(3))
cline=ubound(clst)
for i=0 to cline
if clst(i).indexof("=")>0 then
if clst(i).split("=").trim()=insection then
nosec=true
getvalue=clst(i).split(''=").trim()
exit for
enf if
end if
next
if nosec=true then
return getvalue
else
label1.text="没有找到"&inisection&"的设置信息"
endif
end function
步骤4:在Button1的"click"事件中添加如下代码:
dim name as string=getiniinfo(applicaiton.startuppath"&\iniread.ini","name")
txtfile.text=name
步骤5:测试
要求:把你可以理解的代码注释
必须先创建一个ini文件

Admin
Admin

帖子数 : 7
注册日期 : 08-03-14

http://nettech.longluntan.cn

返回页首 向下

返回页首


 
您在这个论坛的权限:
不能在这个论坛回复主题