用VB做一个简单的东西

来源:百度知道 编辑:UC知道 时间:2024/05/22 12:19:48
这个东西只有一个输入框
1.如果在这个输入框内输入123
2.就在C:\WINDOWS\txt生成123.txt
3.之前输入过的123保存到配置信息里面,下次不能重复输入
在追加100分
上面说的不能重复输入,不是说检测到本地已经存在,把输入生成过的数据全部保存到单独的配置文件
比如生成过123.txt 换一台电脑在输入123 还是不能生成

private sub Command1_Click()
dim strFile as String
Dim iFile as integer

strFile = Text1.Text
if dir("C:\WINDOWS\txt" &strFile &".txt")<>"" then
msgbox "文件存在"
Text1.Text=""
iFile=FreeFile
open "C:\WINDOWS\txt" &strFile &".txt")<>"" for output AS #iFile
put #iFile,,strFile
close #iFile
end sub
==================================
配置文件设置为程序运行目录下的conf.txt

private sub Command1_Click()
dim strFile as String
dim strPath as String
Dim iFile as integer
Dim IsOK as Boolean
Dim strData as String

strPath=iif(right(app.path,1)="\",app.path,app.path)
strFile = Text1.Text
IsOK = True
if dir(strPath & "conf.txt") then
iFile=FreeFile
open strPath & "conf.txt" for input AS #iFile
do while not