|
-
Jul 3rd, 2000, 04:22 PM
#1
Thread Starter
Frenzied Member
What I'm trying to make a regestration window come up only the first time the user runs this program. so can someone tell me what i'm doin wrong?
Code:
Private Sub Command1_Click()
If fso.FolderExists("c:\dimas password\") Then
Open "C:\dimas password\01.dat" For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
Else:
MkDir "C:\dimas password\"
Open "C:\dimas password\01.dat" For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
End If
End Sub
Private Sub Form_Load()
SetFormPosition Form1.hwnd, vbTopMost
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.filexists("c:\dimas password\01.DAT") Then
Form1.Visible = False
user32.Visible = True
End If
End Sub
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 04:54 PM
#2
_______
1st part
Public sfile
Private Sub Form_Activate()
'SetFormPosition Form1.hWnd, vbTopMost
Dim FSO As Object
sfile = "C:\dimas password\01.dat"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
Form1.Visible = True
user32.Visible = False
Else
Form1.Visible = False
user32.Visible = True
End If
Set fs = Nothing
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 05:01 PM
#3
Thread Starter
Frenzied Member
Re: 1st part
you know how you labeled it part one, is there a part 2? cause it doesn't work
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 05:10 PM
#4
Why use a Flat File? why not use the Registry, i.e.
Code:
Private Sub Form_Load()
Dim sPassword As String
sPassword = GetSetting(App.Title, "Settings", "Password", "")
If Len(sPassword) Then
'Password Found, Verify it...
Else
'Show Registration Form
frmReg.Show vbModal
Endif
End Sub
-
Jul 3rd, 2000, 05:11 PM
#5
_______
dimava
I labeled it part 1 cause it is only the code from
your form load event.
I didn't look at the command button event because I figured
if you loaded the proper form you could take it from
there.
I'm not sure exactly what you are after.
the form load will load the user32 form if your password file doesn't exist and it loads form1 if the password file exists
what do you want to happen?
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 05:19 PM
#6
Thread Starter
Frenzied Member
Re: dimava
There is no password the 3 text boxes are:
First name (txtFN)
Last Name (txtLN)
Company (txtCP)
And the first time ever when the program starts, it asks for that information, and stores it in a file
then when the program starts again (second time), it doesn't ask for that information again, cause its already stored, do you know what I mean? if not, I could reexplain my self.
By the way the code that you gave me above doesn't, work, it always goes strait to the other form, (yes I have checked to make sure that I dont have those files on my hard drive)
and to Aaron... Before I finish the program, I'm gonna put several layers of encyrption to it, and put it in the WINDOWS folder, and make it have a diffrent extension
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 05:31 PM
#7
_______
...ok..maybe I have your form names reversed
I tested it before I posted it and I tested it again.
it returned false and opened user32
I add a folder..dinas passwords and saved 01.dat
it returned true and opened form1
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 05:39 PM
#8
Thread Starter
Frenzied Member
Re: Re: ...ok..maybe I have your form names reversed
Originally posted by dimava
there is still something wrong, this is the code:
Code:
Public sfile
Private Sub Command1_Click()
'If FSO.FolderExists("c:\dimas password\") Then
Open "C:\dimas password\01.dat" For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
' Else:
' MkDir "C:\dimas password\"
' Open "C:\dimas password\01.dat" For Output As #1
' Write #1, txtfn.Text, txtln.Text, txtcp.Text
' Close #1
End Sub
Private Sub Form_Activate()
'SetFormPosition Form1.hWnd, vbTopMost
Dim FSO As Object
sfile = "C:\dimas password\01.dat"
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
user32.Visible = True
Form1.Visible = False
Else
user32.Visible = False
Form1.Visible = True
End If
Set fs = Nothing
End Sub
(I put the ' infront of the code that I wasn't using)
oh yea, the form the the textboxes is form 1
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 06:01 PM
#9
_______
this opens and writes to a file if the form1
comes up...if the file is there it goes to
user32 form...tested it and it's ok..
check my code I changed the name of one of your
text boxes to lower case to match the rest..
Option Explicit
Public sfile
Private Sub Command1_Click()
'If FSO.FolderExists("c:\dimas password\") Then
Open sfile For Output As #1
Write #1, txtfn.Text, txtin.Text, txtcp.Text
Close #1
Command1.Enabled = False
txtfn.Text = ""
txtin.Text = ""
txtcp.Text = ""
' Else:
' MkDir "C:\dimas password\"
' Open "C:\dimas password\01.dat" For Output As #1
' Write #1, txtfn.Text, txtln.Text, txtcp.Text
' Close #1
End Sub
Private Sub Form_Activate()
sfile = "C:\dimas password\01.dat"
'SetFormPosition Form1.hWnd, vbTopMost
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
user32.Visible = True
Form1.Visible = False
Else
user32.Visible = False
Form1.Visible = True
End If
Set FSO = Nothing
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 06:06 PM
#10
Thread Starter
Frenzied Member
ok, 2 things......
1. its not in, its LN
2. I still have a problem, the yellow arrow shows to this:
Code:
Option Explicit
Public sfile
Private Sub Command1_Click()
'If FSO.FolderExists("c:\dimas password\") Then
--------------------> Open sfile For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
Command1.Enabled = False
txtfn.Text = ""
txtln.Text = ""
txtcp.Text = ""
' Else:
' MkDir "C:\dimas password\"
' Open "C:\dimas password\01.dat" For Output As #1
' Write #1, txtfn.Text, txtln.Text, txtcp.Text
' Close #1
End Sub
Private Sub Form_Activate()
sfile = "C:\dimas password\01.dat"
'SetFormPosition Form1.hWnd, vbTopMost
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
user32.Visible = True
Form1.Visible = False
Else
user32.Visible = False
Form1.Visible = True
End If
Set FSO = Nothing
End Sub
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 06:20 PM
#11
_______
//
add this to the top of the command1 event
I know, you shouldn't need to but hey
give it a shot...It works for me so it must be
some little thing...
sfile = "C:\dimas password\01.dat"
what reason comes with the yellow line
sorry it takes so long in between, I'm at work and
flipping back and forth...
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 06:24 PM
#12
_______
Ok..got it...because you have code commented out
you are trying to open a file for output when the
directory doesn't exist...
I deleted the dir on mine and got the same
problem yellow line on open..make sure the dir
exists before creating the file to put in the dir.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 06:26 PM
#13
Thread Starter
Frenzied Member
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 06:29 PM
#14
Thread Starter
Frenzied Member
Re: Re: //
ok, I get it, now lets go back to the beggning, how do I make it check if the directory is already there, and if not, then create it
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 06:31 PM
#15
_______
<< ? >>
''complete package...
Option Explicit
Public sfile
Private Sub Command1_Click()
'SetFormPosition Form1.hWnd, vbTopMost
Dim fFSO As Object
Set fFSO = CreateObject("Scripting.FileSystemObject")
If fFSO.FolderExists("c:\dimas password\") Then
Open sfile For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
Command1.Enabled = False
txtfn.Text = ""
txtln.Text = ""
txtcp.Text = ""
Else:
MkDir "C:\dimas password\"
Open "C:\dimas password\01.dat" For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
End If
Set fFSO = Nothing
End Sub
Private Sub Form_Activate()
sfile = "C:\dimas password\01.dat"
'SetFormPosition Form1.hWnd, vbTopMost
Dim FSO As Object
Set FSO = CreateObject("Scripting.FileSystemObject")
If FSO.fileexists(sfile) = True Then
user32.Visible = True
Form1.Visible = False
Else
user32.Visible = False
Form1.Visible = True
End If
Set FSO = Nothing
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 06:43 PM
#16
Thread Starter
Frenzied Member
Re: << ? >>
NXSupport - Your one-stop source for computer help
-
Jul 3rd, 2000, 06:44 PM
#17
_______
oops
I guess we posted at the same time or whatever.
that complete one doesn't have the check for
directory..give me a min or two and I'll send it
up to you...
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 07:00 PM
#18
_______
// over and out...
'add this function and use this new command1 event
'it cuts down on wated code...
Public Function DirExists(ByVal sDirName As String) As Boolean
Dim sDir As String
On Error Resume Next
DirExists = False
sDir = Dir$(sDirName, vbDirectory)
If (Len(sDir) > 0) And (Err = 0) Then
DirExists = True
End If
End Function
Private Sub Command1_Click()
'SetFormPosition Form1.hWnd, vbTopMost
'if it's not there create it
If DirExists("C:\diva password\") = False Then
MkDir ("C:\diva password")
End If
Open sfile For Output As #1
Write #1, txtfn.Text, txtln.Text, txtcp.Text
Close #1
Command1.Enabled = False
txtfn.Text = ""
txtln.Text = ""
txtcp.Text = ""
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Jul 3rd, 2000, 07:05 PM
#19
Thread Starter
Frenzied Member
Re: // over and out...
WOW, thanks alot, it really worked
NXSupport - Your one-stop source for computer help
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
|