roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
ahh...so its pretty simple then i assume..our lecturer was making out it would be really hard (gimp)
|
|
01/11/2007 04:22 AM |
|
roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
Next Question now
Wee've been given this code, and need to Mask the password box, but i have no idea, not even slightly, everything i tried failed miserably
Can anyone mask this, or give me a code with the same function that will work please???
|
|
02/11/2007 04:53 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: VB.net help
From knowledge of VB6, you can't mask an InputBox (well, not without some subclassing of sorts - probably too much for you).
What you need to do is make a new form, just for the password, and have a masked textbox or passwordbox.
|
|
02/11/2007 07:07 AM |
|
roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
in that case...what command do i use to shutdown a form when i load up a new one then, even our lecturer didnt know, i will confess hes useless
Oh...and
What's wrong with this that's making the loop not work with my label?? (it is named correctly)
Wee have another breakththrough, i realise why the label isn't showing up correctly, it has to be defined as F2.lblAttempt in form1, i think
If i post up, in a zip file, what i have so far, can anyone experienced that a peep at whazt im doing wrong??
Compiled Programs.zip (Size: 69.05 KB / Downloads: 211)
Oh, and ignore form3, i know it can be done better, but it suits my purposes, and it was the easiest way wee knew
(This post was last modified: 02/11/2007 02:32 PM by roberth.)
|
|
02/11/2007 07:59 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: VB.net help
roberth - try looking into modal forms. IDK how to do it in VB.NET, but in VB6, it would be something like:
A modal form stops execution in the current form, like an InputBox.
Another point, your logic here is incorrect:
What you're saying is, set the label, increment a variable, then keep looping until you've incremented the variable to 4 (note that the label is set before the incrementation, so it will display "3"). The condition (txtPass.Text = Password) is irrelevant, as txtPass is never updated (the user is never given the chance).
What you should do is have some code like you did before, with the InputBox. Instead of using an InputBox however, use a modal form.
|
|
02/11/2007 07:04 PM |
|
roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
not completley sure i understand :P, but i can see what you mean
And where have i defined my attempt as 3 exactly??...i can't find it, and that's one of the major problems :(
Haha...very nealry done now...only problem is that i can't seem to stop the process after one attempt up
Ill get this soon
(This post was last modified: 03/11/2007 04:41 AM by roberth.)
|
|
03/11/2007 04:04 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: VB.net help
roberth Wrote:And where have i defined my attempt as 3 exactly??...i can't find it, and that's one of the major problems :(
Okay, umm, I'll try to explain it better:
So, when you start the loop, Attempt =1.
First thing you do in the loop is set the attempt label to "1", then you add 1 to Attempt (so Attempt =2)
Then it will check the loop condition. Since txtPass.Text is never changed within the loop, (txtPass.Text = Password) will _always_ be false. So the condition can be broken down to Loop Until (Attempt = 4) Or False
You're "Or'ing" a False, which is equivalent to not "Or'ing" anything, so the above condition is equivalent to Loop Until (Attempt = 4).
Okay, so, since Attempt =2 at this point in time, the condition is False, and the loop continues.
On the next iteration of the loop, Attempt =3.
On the next iteration after that, when Attempt =3, the label is set to "3", Attempt is incremented (so Attempt now =4). Then wee check the loop condition. (Attempt = 4) is now true, so the loop exits.
So, the last value the label was set is "3".
This is because the loop isn't "delayed", that is, the computer sets the label to "1", "2" then "3", however, it does it so fast that you only see the final thing, a "3".
Hope that helps.
|
|
03/11/2007 04:50 AM |
|
roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
yeah, i see, ive updated it to this
And the loop works fine now, but i want the end if to go after the loop until ,yet all it does is bitch at me if i try that
Well, fine ish. It loops, but i can't define it to stop, as i don't know how, and wheehter or not its right, it displays whichever text box 3 times before ending itself, either back to Form1 (without a chance for another attempt), or into the currency convertor..so i think im getting closer, but im not there yet am i...
(This post was last modified: 03/11/2007 05:41 AM by roberth.)
|
|
03/11/2007 05:00 AM |
|
ZiNgA BuRgA
Smart Alternative
Posts: 17,022.2988 Threads: 1,174
Joined: 19th Jan 2007
Reputation: -1.71391
E-Pigs: 446.1274
|
RE: VB.net help
I don't know if this is valid VB.NET syntax (you'll have to look it up), but this is probably what you should write. I hope you can understand the logic of the code.
Well...
If you still want to take a punt at it, I'll give you a hint - using a loop is probably not the best way (might be if you were writing C).
|
|
03/11/2007 07:19 AM |
|
roberth
Resident Full Stop Abuser.....
Posts: 4,580.2098 Threads: 200
Joined: 18th Jun 2007
Reputation: -5.5814
E-Pigs: 43.8419
|
RE: VB.net help
Indeed, i see
Makes sense, and ill try it out asap
all works fine, except the value Attempt doesn't go up still, and in the code you supplied it isn't defined as an integer, is there a reason for that??
(This post was last modified: 04/11/2007 05:53 AM by roberth.)
|
|
04/11/2007 05:36 AM |
|