LEARN VB.NET 2008 L3 PASSWORD PROTECTED FORM 2 FORMS & IF
Gymjunnky.com Welcome to learn vb.net this is tutorial 3 and my name is Gym_
In this lesson were going to learn some tricks with duel forms and learn how to do some very basic pass word protected applications
So lets get right to it,,
1st thing is open up VB.net ether 2005 or 2008 if you have Vb6.0 have a look on my channel or website and your will find plenty of tutorials for VB 5 and 6.0
Ok so lets get on with the show shall we.
Going to open up windows form application and change the name to project 3 and click ok
Then im going to draw a button on the form
Then im going to add a 2nd form
Do this by clicking on project link at the top of VB and then the add windows form tab
Then were going to scroll right down the bottom till we see windows form and ether double click on it or high light it and click OK
This is going to add the 2nd form to our project
After that were going to double click on the button we made on our form1 and insert the codes to open and close our forms
Form2.show is used to make our 2nd form visible
And me.hide closes no1 form in vb6.0 you could use form1.hide but in 2005 and 2008 you must use the term ME as reference to the form that the code is being placed into
And that’s it all of 4 words to open and close 2 forms
So let’s run the program and have a quick look
Cool that works
So again let’s try something a little more advanced,,, let’s make form 2 pass word protected
Click on the text box icon and draw a textbox on form 1
If textbox 1 . text = “123456″ then
Ok see the blue line its telling us that there is a error,, and if we hover our mouse over the top of it u can see its telling us there is no end if at the end of the stamen
So after we make shore we have our quotation marks in place let’s put in that end if statement
And lets run the program again
Click the button and nothing happiness
Put in the wrong pass word and click the button
And nothing happens
Enter the correct password and form 2 shows up and form 1 closes
Now that certainly dose the job but how about we make it a bit better
So 1st thing i want to do is change the colours on the forms so it can be seen a lot more easily on video.
Lets change form1 to blue and form 2 to a dark red
Ok to improve the function ability of this pass word protected form let put in a else statement
After form show and hide type in Else
Then Msgbox ” wrong pass”
This means that is the if anything ells what so ever happens besides that pass word being right then the else stamen kicks in and in this case provides us with a message box saying wrong password
Ok so lets see this in action shall we
Run the program click the button with no pass word in we get message box
Type in the wrong pass word,,, and we get message box
Type in the right password and get form 2 appearing and form to leaving
..
what about if we want multiple boxes like how that have the key login on windows and a lot of other software as your instilling it.
Very easy lets put 2 more text boxes on our form
And then go into our code and put
If text1 . text = “123456″ and text2 . text = “123456″ and text3. Text = “123456″ then
Format C drive,,, nar just kidding
Form2.show
Me. Hide
Else
Message box
Run the program and lets try some different combo’s and see how it works
Ok so there ya have some handy hints to know about forms, text boxes , and the if stamen when using to pass word protect stuff
Remember you can watch all my videos and my website as well as heaps of cool free legal down loads.. All the source codes to my projects as well as help forums on
www. gymjunnky.com
My name is Gym and you have been watching learn to program in VB.NET tutorial 3
Duration : 0:8:15
[youtube ujQPTS0DsNA]
August 6th, 2009 at 11:14 pm
driftkinguk26, …
driftkinguk26, double click the text box and enter “TextBox?.MaxLength = 5″
August 6th, 2009 at 11:14 pm
aha! nice jobb
…
It helped a lot. And the voice was VERY clear, unlike most other videos where they voice narrated it. Except… Maybe you could show how to use a masked textbox instead? it would be helpful
Rated:5 + Subscribed!
aha! nice jobb
August 6th, 2009 at 11:14 pm
how do i set the …
how do i set the limit of characters in the password cos i only want 5 in each box
August 6th, 2009 at 11:14 pm
same lol
same lol
August 6th, 2009 at 11:14 pm
idk i would like to …
idk i would like to know it to i tryed manny things but it dont work
August 6th, 2009 at 11:14 pm
Hey , What Would I …
Hey , What Would I Do If I Wanted More Than One Password? Cos I Have Tried -
If Textbox1.text = (”12345″) Or (”93748″) Then …
If Textbox1.text = (”122131″ , “298393″) Then…
Please Can You Help Me ?
Reply Soon
August 6th, 2009 at 11:14 pm
lol at format c …
lol at format c drive haha. great tut
August 6th, 2009 at 11:14 pm
thx sir..
just the …
thx sir..
just the perfect video for my homework..
really big thx!!
August 6th, 2009 at 11:14 pm
nice vid man!
nice vid man!
August 6th, 2009 at 11:14 pm
gd video man and …
gd video man and the ending song is so in cool keep the gd work up
Zero Code
August 6th, 2009 at 11:14 pm
use a maskedtextbox …
use a maskedtextbox or set the passwordchar to “*”
August 6th, 2009 at 11:14 pm
use a maskedtextbox …
use a maskedtextbox and set usepasswordchar to “True”
August 6th, 2009 at 11:14 pm
Hey mate, thanx for …
Hey mate, thanx for the tut
August 6th, 2009 at 11:14 pm
good tut but 1 …
good tut but 1 promblem the else part doesnt work then it says coreect pass then inccorect
August 6th, 2009 at 11:14 pm
loool
loool
August 6th, 2009 at 11:14 pm
Very unsecure.
…
Very unsecure.
When compiled as an EXE you can open it in a text editor and find the password.
August 6th, 2009 at 11:14 pm
i have vb 2008 do …
i have vb 2008 do you know or can you find out anything on how to do that
August 6th, 2009 at 11:14 pm
Hi corvettezack, I …
Hi corvettezack, I can tell you how does it work on vb6. find text box’s property “PasswordChar” and type there * after that everything what you type will be shown as *. Hope that helps you
August 6th, 2009 at 11:14 pm
how do i make it so …
how do i make it so when i type anything in the pw box it looks like a star *
August 6th, 2009 at 11:14 pm
I love ur voice, …
I love ur voice,sounds encouraging
August 6th, 2009 at 11:14 pm
hahahahha you are …
hahahahha you are cool!!
August 6th, 2009 at 11:14 pm
Your a great …
Your a great tutorialist….good job mate, keep up the good work.
August 6th, 2009 at 11:14 pm
Thanks!!
Thanks!!
August 6th, 2009 at 11:14 pm
you rock!
you rock!
August 6th, 2009 at 11:14 pm
i like his accent
…
i like his accent
but this is just another stupid video tutorial in youtube
tsk tsk:::how will u change ur password when u run the program?? theres no way