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