|
-
Jun 30th, 2000, 02:22 PM
#1
Thread Starter
Hyperactive Member
Private Sub Form_Load()
Dim stCurDir As String
Dim stIniFile As String
stIniFile = App.Path & "\list.ini"
'make sure the file exists
If Dir$(stIniFile) <> "" Then
Open stIniFile For Input As #1
Line Input #1, stCurDir
If Trim$(stCurDir) <> "" Then
If Dir$(stCurDir, vbDirectory) <> "" Then
ChDir (stCurDir)
End If
End If
Close #1
End If
End Sub
It wont open the .ini to get the set directory...
Why?
-
Jun 30th, 2000, 03:45 PM
#2
Have you checked the value of stIniFile to make sure it's looking in the right place?
App.Path points to the location from which your project was launched, so if you opened your project from within VB, then the App.Path would point to your VB location, i.e. "C:\Program Files\Microsoft Visual Studio\VB98"
-
Jun 30th, 2000, 03:48 PM
#3
Thread Starter
Hyperactive Member
nope...in the right place...it just wont read the .ini file...is there another way to do it?
-
Jun 30th, 2000, 05:39 PM
#4
Have you traced the code to see what is happening? I copied your code and placed a list.ini file in the app.path and while I don't know what your list.ini file looks like, by tracing I was able see that the ini file is read.
-
Jun 30th, 2000, 06:17 PM
#5
transcendental analytic
You could always handle using else in your code whenever you use if to avoid errors:
Code:
Private Sub Form_Load()
Dim stCurDir As String
Dim stIniFile As String
stIniFile = App.Path & "\list.ini"
'make sure the file exists
If Dir$(stIniFile) <> "" Then
Open stIniFile For Input As #1
Line Input #1, stCurDir
If Trim$(stCurDir) <> "" Then
If Dir$(stCurDir, vbDirectory) <> "" Then
ChDir (stCurDir)
Else
MsgBox "Stored Directory " & stCurDir & "not found"
End If
Else
MsgBox "INIFILE empty"
End If
Close #1
Else
MsgBox "INIFILE " & stIniFile & " not found"
End If
End Sub
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Jun 30th, 2000, 06:22 PM
#6
Thread Starter
Hyperactive Member
I fixed it...
(If your free please check out my post titled Lawrence Jesterton)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|