啟動時 Private Sub Form_Load() If Dir("C:\WINNT\system32\ICtxtPathSet.set") <> "" Then Close #1 Open "C:\WINNT\system32\ICtxtPathSet.set" For Input As #1 Input #1, SetPath Close #1 txtPath.Text = SetPath End If End Sub退出時: Private Sub butExport_Click() Open "C:\WINNT\system32\ICtxtPathSet.set" For Output As #1 Print #1, sFileName Close #1 End Sub
(form_load中写的代码) dim setpath as string If Dir(App.Path & "\PathSet.txt") <> "" Then Close #1 Open App.Path & "\PathSet.txt" For Input As #1 Input #1, setpath Close #1 Text1.Text = setpath (确定按钮里写的代码) Open App.Path & "\PathSet.txt" For Output As #1 Print #1, strResFolder Close #1 这是我的代码 能不能帮我找出原因
代码修改如下 form_load中写的代码) dim setpath as string If Dir(App.Path & "\PathSet.txt") <> "" Then Close #1 else Open App.Path & "\PathSet.txt" For Input As #1 Input #1, setpath Close #1 Text1.Text = setpath 但是根本读不了 text1.text仍为空
我的那个上面没有退出按钮,所以我用了一个确定按钮代替,当输入文件名后再点击一下确定按钮 代码如下 Open App.Path & "\PathSet.txt" For Output As #1 Print #1, strResFolder Close #1 但就是读不了
代码再改改 Private Sub Form_Load()中的不变Private Sub butExport_Click()的改为如下:Private Sub butExport_Click() CommonDialog1.FileName = "" CommonDialog1.Filter = "XLS文件(*.txt)|*.txt" CommonDialog1.ShowOpen txtPath.Text = CommonDialog1.FileName sfilename = Dlog.FileName If sfilename <> "" Then Open "C:\WINNT\system32\ICtxtPathSet.set" For Output As #1 Print #1, sFileName Close #1 End If End Sub
Private Sub Form_Load()
If Dir("C:\WINNT\system32\ICtxtPathSet.set") <> "" Then
Close #1
Open "C:\WINNT\system32\ICtxtPathSet.set" For Input As #1
Input #1, SetPath
Close #1
txtPath.Text = SetPath
End If
End Sub退出時:
Private Sub butExport_Click()
Open "C:\WINNT\system32\ICtxtPathSet.set" For Output As #1
Print #1, sFileName
Close #1
End Sub
怎么可我的文件是空白的,里面什么都没写啊
lngre = WritePrivateProfileString("SetPath" + Str(num), " ", tempstr, App.Path & "\SetPath.ini")
dim setpath as string
If Dir(App.Path & "\PathSet.txt") <> "" Then
Close #1
Open App.Path & "\PathSet.txt" For Input As #1
Input #1, setpath
Close #1
Text1.Text = setpath
(确定按钮里写的代码)
Open App.Path & "\PathSet.txt" For Output As #1
Print #1, strResFolder
Close #1
这是我的代码
能不能帮我找出原因
form_load中写的代码)
dim setpath as string
If Dir(App.Path & "\PathSet.txt") <> "" Then
Close #1
else
Open App.Path & "\PathSet.txt" For Input As #1
Input #1, setpath
Close #1
Text1.Text = setpath
但是根本读不了
text1.text仍为空
代码如下
Open App.Path & "\PathSet.txt" For Output As #1
Print #1, strResFolder
Close #1
但就是读不了
Private Sub Form_Load()中的不变Private Sub butExport_Click()的改为如下:Private Sub butExport_Click()
CommonDialog1.FileName = ""
CommonDialog1.Filter = "XLS文件(*.txt)|*.txt"
CommonDialog1.ShowOpen
txtPath.Text = CommonDialog1.FileName
sfilename = Dlog.FileName
If sfilename <> "" Then
Open "C:\WINNT\system32\ICtxtPathSet.set" For Output As #1
Print #1, sFileName
Close #1
End If
End Sub