Oct 19th, 2004, 09:42 AM
#1
Thread Starter
Lively Member
compare variables
can someone help me
i want to create some sort of login
this is what i have
VB Code:
Function logingo()
Dim urlbestand As String
Dim gegevens As String
Dim splitten As String
Dim splitten2 As String
Dim splitten3 As String
Dim splitten4 As String
Dim splitten5 As String
Dim bstand As Boolean
Dim pathnaam As String
Dim loginjuist As Boolean
urlbestand = Environ("commonProgramFiles") & "\dcq369\log.dat"
pathnaam = Environ("commonProgramFiles") & "\dcq369\schrfbvgdhd.dat"
If Len(Dir$(urlbestand)) > 1 Then
bestand = True
Else
MsgBox "er zijn geen personen geregistreerd", vbExclamation, "opmerking"
End If
If bestand = True Then
Open urlbestand For Input As #1
gegevens = Input(LOF(1), #1)
Close #1
splitten = Split(gegevens, "||")(1)
splitten2 = Split(splitten, "=")(1)
For i = 1 To splitten2
splitten3 = Split(gegevens, "||")(i + 1)
splitten4 = Split(splitten3, "&&")(0)
splitten5 = Split(splitten3, "&&")(1)
[COLOR=red]
MsgBox splitten4
MsgBox splitten5
MsgBox Text1.Text
MsgBox Text2.Text
[/COLOR]
If splitten4 Like Text1.Text And splitten5 Like Text2.Text Then
loginjuist = True
Exit For
Else
loginjuist = False
End If
Next i
End If
If loginjuist = True Then
Open pathnaam For Output As #1
Print #1, "ja"
Close #1
progamma.Show
Unload login
Else
MsgBox "uw gegevens zijn fout probeer opnieuw of druk op doorgaan", vbExclamation, "opmerking"
End If
End Function
the message boxen in red are being compared but they are equal and the script don't seethem as equal variables what do i have to do to get them equal
Last edited by davyquyo; Oct 19th, 2004 at 08:28 PM .
Oct 19th, 2004, 10:24 AM
#2
There may be spaces at the end of one of the variables.
Oct 19th, 2004, 11:55 AM
#3
Thread Starter
Lively Member
i used trim to delete spaces but stil it won't work
wat else can i do
i figured out that this is wrong
And splitten5 Like Text2.Text
because when i remove this it works good
any suggestions
i als say that Text2.Text has pasword character
maybe this is wrong can it be ????
Last edited by davyquyo; Oct 19th, 2004 at 12:02 PM .
Oct 19th, 2004, 12:44 PM
#4
Lively Member
Add parens to control the order of operation:
VB Code:
If ((splitten4 Like Text1.Text) And (splitten5 Like Text2.Text) Then
Oct 19th, 2004, 12:49 PM
#5
Thread Starter
Lively Member
when is just say this
if splitten5 Like Text2.Text Then
then i got the same problem
Oct 19th, 2004, 01:01 PM
#6
Put a breakpoint on that line. What are the values of the two variables?
Oct 19th, 2004, 01:10 PM
#7
Thread Starter
Lively Member
wel the is for the user to decide i test it with my family name
in the message i receive this
splitten5=quyo
Text2.Text=quyo
Oct 19th, 2004, 01:14 PM
#8
Instead of the MsgBox, do exactly this:
Debug.Print "X" & splitten5 & "X"
Debug.Print "X" & Text2.Text & "X"
Are the results the same?
Oct 19th, 2004, 01:33 PM
#9
Thread Starter
Lively Member
Oct 19th, 2004, 01:45 PM
#10
Thread Starter
Lively Member
i placed this in the web maybe someone can take a look at it
i hope you can help me
http://www.davyquyo.be/login.zip
Oct 19th, 2004, 02:04 PM
#11
Originally posted by davyquyo
nope won't do
What do you mean?
Oct 19th, 2004, 02:42 PM
#12
Thread Starter
Lively Member
wel download the program
register en then login
you wil see that variables are the same
but the login is not accepted
i replaced youre parts but the same effect take's place
there where no error's
Oct 19th, 2004, 03:43 PM
#13
Member
Wow.. this seems like an exceedingly difficult login routine.
Why, exactly - are you trying to compare the two strings?
Or are you just comparing the two because it's not working correctly?
It's hard to figure out whats going on when it's written in German(?). Even though the language (VB) hasn't changed at all.
However.. after adding a breakpoint to the Login button and stepping through the code.. I found that somewhere there are two extra characters appended to the end of your "password" string..
I attached a picture of what i'm talking about..
Attached Images
What do you mean it doesn't work? I had it working just a minute ago!
Oct 19th, 2004, 07:26 PM
#14
Originally posted by Kedaeus
Wow.. this seems like an exceedingly difficult login routine.
Why, exactly - are you trying to compare the two strings?
Or are you just comparing the two because it's not working correctly?
It's hard to figure out whats going on when it's written in German(?). Even though the language (VB) hasn't changed at all.
However.. after adding a breakpoint to the Login button and stepping through the code.. I found that somewhere there are two extra characters appended to the end of your "password" string..
I attached a picture of what i'm talking about..
That's what I was trying to show by adding an "X" at the start and end of the variables. It would have shown (at least) that one was longer than the other.
Oct 19th, 2004, 08:23 PM
#15
Thread Starter
Lively Member
it's written in dutch and i'm not good ad vb
i'm a flashdesigner
but this is what i use to get date out of a textfield for some sord of login
i willl try to solve the problem
and i added the messageboxen so i could see what was goining and if my vars where correct
now dat i know what the problem is i have solved the problem
thanx for the help
Last edited by davyquyo; Oct 19th, 2004 at 08:28 PM .
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