Are you running it from the IDE or the exe?Quote:
Originally posted by Edneeis
Although if you run it from the IDE it will keep resetting to a new execution but it will run fine from the exe itself.
Printable View
Are you running it from the IDE or the exe?Quote:
Originally posted by Edneeis
Although if you run it from the IDE it will keep resetting to a new execution but it will run fine from the exe itself.
the exe
Maybe its something you missed transferring it from the example. Or at least the example worked properly for me. On a sucessful entry of the number it should write that number to the app.config file which will prevent it from being shown again.
VB Code:
Public Shared Function IsRegistered() As Boolean Dim aps As New AppSettings If aps.GetValue("keycode").ToString = "2" Then Return True Else Dim frm As New Form3 If frm.ShowDialog = Windows.Forms.DialogResult.OK Then Return True End If End Function
that code you posted would mean that the correct keycode would be "2". Also I'm not sure but I think app.config files are case sensitive so "keycode" and "Keycode" are not the samething although if it is that then it should give an error.
Yours works perfectly, IM trying to go though the code but it wont let me place my variables with the correct password, ur is "123456" but it wont let me just put hi3 hi3 is what the program checks, if hi3 = the registration number that is inputed than it is correct
So you are saying that the user would type in "hi3" as the registration?
no, hi3 is what the correct password form the user should be. say hi3 = 10 if the user inputs 10 then the main form should load
Do you want to take a quick look at it?
So hi3 is what you called the variable that holds the correct password/registration?
Typically you would have whatever you are using to validate a correct registration in the code I pointed out. So in logic it works like this:
Public Function IsRegistered
Retrieve previously entered data
If previously entered data is valid then run main form
Otherwise show the registration form
End Function
VB Code:
Public Shared Function IsRegistered() As Boolean 'get stored/previously entered data Dim aps As New AppSettings 'check stored data to see if it is correct If aps.GetValue("keycode").ToString = "2" Then 'stored value was valid so show the main form Return True Else 'stored value as either missing or not valid so show the register form Dim frm As New Form3 If frm.ShowDialog = Windows.Forms.DialogResult.OK Then Return True End If End Function
Sure.Quote:
Originally posted by VBGangsta
Do you want to take a quick look at it?
Ill send it over via email.
did u find a problem?
No I didn't even find an email. You might try sending it again: [email protected]
now take a look
Still nada.
The ePostman must be running behind today.
I guess so:) , it should be there because i sent it 3 times
Get it yet?
I finally got it. It works. If you enter '2' then it means you successfully registered and it doesn't show up again. That is how you have it in two places:
pintpassword = TextBox1.Text
If pintpassword = ("2") Then
and
If aps.GetValue("keycode").ToString = "2" Then
Also as a word of advise you should get in the habit now while you are just starting of giving your variables and forms meaningful names. So change form3 to frmregister or something that describes what it does.
To fix your problem I think you want to replace "2" in the code parts above with hi3. This will tell you there is a problem in the IsRegistered function. This is because it is shared and the hi3 variable is not. So you'll need to make hi3 shared or better yet make a function to retrieve the correct keycode and use that in place of hi3.
I changed the 2 too hi3 in both places and made hi3 shared. But now the login form doesnt show at all it goes right to the main form
Yes because you also need to control when it initializes. You see then app.config has "" by default and since you don't make hi3 equal anything until the frmregister load event then before that it equals "" too. So before loading the form it checks for a match and finds it because both equal "". That is why I mentioned the function. I will email you your project back with an example.
ok, thank you
Edneeis you never fail to impress me. You do not know how much you have helped me. Thank you so much for helping me and being patient.......... DO you think its un safe to have a passwrod based on math in my program? Is there a way i can encrpt my code so it cannot be edited?