PITBULLCJR
Jan 25th, 2000, 05:16 AM
Well as you can see I am back into fooling around with ini files. I am making a program for some of my teachers. It is a vocab builder. They can create and open up ini files full of vocab words and definitions. Then they can use another part of the prog to let there students practice and it will randomly choose a vocab word and ask for its def. Well you guys get where this is heading. So I ran into this little problem. If they go to create a ini file with the same name as an older one it will combine the two and thats not good. So I put in the ini file a special little thing that only my vocab ini files will have so if the program looks and sees that it is there it will tell you to change the name and if it can't find it then it will create it. I can't get it to detect it thoughthis is my code:
Option Explicit
Dim path As String
Dim check As String
Private Sub Form_Load()
path = App.path & IIf(Right$(App.path, 1) = "\", "", "\")
File1.path = path & "Vocab Lists\"
End Sub
Private Sub Command2_Click()
lpAppName = "Chris Rysdyk's Vocab Builder List"
lpKeyName = "Chris"
lpDefault = path & "Vocab Lists\" & Text1.Text & ".ini"
lpFileName = path & "Vocab Lists\" & Text1.Text & ".ini"
ret = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
Else
check = Trim(Temp)
End If
Label1.Caption = check
If check = "True" Then
MsgBox "There is already a vocab list with the name " & Text1.Text & " please change to a different name", vbOKOnly, "Error Creating File"
Else
MsgBox "File was created"
End If
End Sub
This is what is in my ini file
[Chris Rysdyk's Vocab Builder List]
Chris=True
Does anyone see what I did wrong? Please help me!!! Thanks
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email pitbullcr7@aol.com
Option Explicit
Dim path As String
Dim check As String
Private Sub Form_Load()
path = App.path & IIf(Right$(App.path, 1) = "\", "", "\")
File1.path = path & "Vocab Lists\"
End Sub
Private Sub Command2_Click()
lpAppName = "Chris Rysdyk's Vocab Builder List"
lpKeyName = "Chris"
lpDefault = path & "Vocab Lists\" & Text1.Text & ".ini"
lpFileName = path & "Vocab Lists\" & Text1.Text & ".ini"
ret = GetPrivateProfileString(lpAppName, lpKeyName, lpDefault, Temp, Len(Temp), lpFileName)
If ret = 0 Then
Beep
Else
check = Trim(Temp)
End If
Label1.Caption = check
If check = "True" Then
MsgBox "There is already a vocab list with the name " & Text1.Text & " please change to a different name", vbOKOnly, "Error Creating File"
Else
MsgBox "File was created"
End If
End Sub
This is what is in my ini file
[Chris Rysdyk's Vocab Builder List]
Chris=True
Does anyone see what I did wrong? Please help me!!! Thanks
------------------
Sincerely,
Chris
:-) ;-)
just have fun out there and live life to the fullest while it is still here
Email pitbullcr7@aol.com