I dont see base class events in the left drop down, and also do all the reamarks apply to me?
Printable View
I dont see base class events in the left drop down, and also do all the reamarks apply to me?
Go to the code for one of the forms. You can't be in the code for the module, since modules don't have Base Class Events.
<EDIT> Actually, go into the main form code, since that's the one you want to add the thing to.
And yes, almost all the remarks are to you. I'm terrible about commenting just for myself. Anything that uses the word "You" is directed at you, and most of the other stuff.
<EDIT AGAIN> Although, in the main form you only need to worry about the very last line of code, and the accompanying comments, everything else in that form is for me.
Nevermind I now understand, Do all the remarks apply to me?
ok, this seems pretty complex
sry posted by mistake
It is a little convoluted(As my VB teacher would say) isn't it. I would have thought that there would be an easier way, but I havent found one. Of course, I'm somewhat of a newbie myself. Probably in ten minutes some pro will see this thread and say: "Igonre that idoiot named Phoenix, Here's a much easier way!" And proceed to show you something that takes ten seconds. :D
You should have seen me when my VB book told me to click on "Base Class Events", I swear, I looked for forty-five minutes, then gave up and asked the teacher, lol.
lol, as long as it works its good for me. I do the same thing i look though my books for hours looking for answers to stupid questions i have but never find them, your lucky to have a teacher i wish i had one
I dont see any editing that needs to be down in the module so i left it. But Explict things made errors somewhere in the code do I removed it9Msybe is y its not working). and I took at the part where if the line is blank. I get no errors but its like i didnt do anything. the loging still comes up even after i put in the password.
I did everything u said. Do u want to see my project?? It might be easier if u see what I am doing.
I'm not sure what Phoenix gave you but here is how I'd do it.
Lol!!
See!! Didn't I tell you?! Ten-second solution right there. No lousy text files, no stupid two pages of code, just simple perfect working code. He was nice about, but it's exactly what I said. :D
Nice, Edeenis. That is about fifteen times more efficeint that my code, I'll have to keep that method in mind for any later use. Although, in my defense, my program needs a lot of the functionality that using text files gives it, like you need to select which user you are on the second time you login, etc. My code isn't totally useless. :p
Sorry for sending you on a pursual of an untamed ornitoid, VBGangsta. Listen to the pros next time, not the newbies. :D
but his keeps making the login form show up even after it is executed once.
I'm sure your code was just as good if not better, its just with coding there are almost always different ways of doing the samething.Quote:
Originally posted by The Phoenix
Lol!!
See!! Didn't I tell you?! Ten-second solution right there. No lousy text files, no stupid two pages of code, just simple perfect working code. He was nice about, but it's exactly what I said. :D
Nice, Edeenis. That is about fifteen times more efficeint that my code, I'll have to keep that method in mind for any later use. Although, in my defense, my program needs a lot of the functionality that using text files gives it, like you need to select which user you are on the second time you login, etc. My code isn't totally useless. :p
Sorry for sending you on a pursual of an untamed ornitoid, VBGangsta. Listen to the pros next time, not the newbies. :D
Edneeis, does yours save the login info so that the login form only shows up the first time the file is executed?
No, was it suppose to? Is this a login form or more like a registration form? I would use an app.config file to persist the login.
yes it is a registraion, it displays a number in one text box(HD# with some mathematical things done to it. And the next text box is empty. so they give me the number that is dispalyed then i reverse the math and give them that number which they enter in the empty text box. then they press a button and if they match it loads the main form. But i dont want the login form to load after the first time the reigitration is entered correctly. Thank you
Here is an example with that added. 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.
wow, nice job. I think i almost got it but what does "keycode" mean in ur program. this is how I changed this part of the script but i dont know what keycode is supposed to do.VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click pintpassword = TextBox1.Text If pintpassword = (hi3) Then Dim aps As New AppSettings aps.SetValue("KeyCode", TextBox1.Text) Me.Hide() Dim Newform1 As New Form1 Newform1.ShowDialog() Else : MsgBox("Registration Code is Incorrect. You need to purchase one from [url]www.eGamingprograms.com[/url]", MsgBoxStyle.Critical) End If End Sub 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
Keycode is the name in the name-value pair that is stored in the app.config file.
Also whats this part:
Me.Hide()
Dim Newform1 As New Form1
Newform1.ShowDialog()
That should be handled in the Sub Main in the module.
yeah i forgot to take thant out. Do i have to do anything to the XML? And i put in all the code but it still performs as if i did nothing. the login keeps coming up, I must have missed something.
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