|
-
Aug 11th, 2000, 07:31 PM
#1
Thread Starter
Frenzied Member
I asked beofre, and someone gave me this code: (sorry I'm not sure who)
Code:
sfile = "C:\01.dat"
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
user32.Visible = True
Form2.Visible = False
Else:
Form2.Visible = False
Form1.Visible = True
End If
Set FSO = Nothing
but everytime the code is processed, it always shows form1, even is the file does exsist
NXSupport - Your one-stop source for computer help
-
Aug 11th, 2000, 07:38 PM
#2
Monday Morning Lunatic
Try explicitly hiding Form1:
Code:
Dim FSO As Object
Dim sFile as String
sFile = "C:\01.dat"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sFile) = True Then
user32.Visible = True
Form2.Visible = False
Form1.Visible = False
Else
Form2.Visible = False
Form1.Visible = True
End If
Set FSO = Nothing
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 11th, 2000, 07:45 PM
#3
Thread Starter
Frenzied Member
sorry, it doesn't work. Also removed the 3 lines:
else
form2.visivle = false
form1.visible = true
and then it just stays on form2
also I am 100% positive that the file exsists
NXSupport - Your one-stop source for computer help
-
Aug 11th, 2000, 07:47 PM
#4
Monday Morning Lunatic
Make sure that the file isn't System or Hidden.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 11th, 2000, 08:09 PM
#5
Thread Starter
Frenzied Member
I'm sure that its not hidden or anything
NXSupport - Your one-stop source for computer help
-
Aug 12th, 2000, 06:31 AM
#6
Monday Morning Lunatic
Try this, using a different file:
Code:
Dim sFile As String
Dim FSO As Object
sFile = "C:\autoexec.bat"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.FileExists(sFile) = True Then
Debug.Print "Exist"
Else
Debug.Print "Not exist"
End If
Set FSO = Nothing
I'm not sure what's up with your other file, so see if it works with any other file.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 12th, 2000, 10:09 AM
#7
Put a breakpoint in the Load event for Form2 and when it is displayed, examine the call stack to see how the event was triggered. I'll make a small bet that there is something in Form1 that is referring to some visible object on Form2, and anytime you do that, the form is shown.
-
Aug 12th, 2000, 10:34 AM
#8
What is User32? Is it a control on one of these forms? Also, you are setting Form2.Visible = False on both sides of the If/Else statement.
"It's cold gin time again ..."
Check out my website here.
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
|