I need to create a project for college using visual basic 2008 express edition. I have to create a quiz with a login and password facility, so when you run the project the user will have to enter their username and password then be taken to the quiz. How would I do this? So far I have created the main form, I then added a login form, project - add windows form - login form. But how do I link the 2 forms together? What code would I need to use?
Thanks in advance for your help, if there is anything you don't understand from my post let me know and I will try explain it better.

... visual basic 2008 express edition ...

This forum is actually for legacy Visual Basic (so to speak version 4, 5, 6).

But for your specific part I don't think that things have changed in the last 10 years.

You would define the login form as the startup form. This could be defined in the project properties in the old VB versions. I guess this is still true. Assuming you have a login button somewhere on the login form, you would capture the event that is triggered when the button is pressed.

Double clicking the button inside VB forms editor will bring you to the code that you have to change.
It will probably be something like

private sub LoginButton_Click()
 ' here would be the code you have to generate
end sub

Now to the code that has to go there
First you would check whether the login was right:

if not txt_field_login = "admin" then
   msgbox "Incorrect user"
   exit sub
end if
if not txt_field_passwd = "secret" then
   msgbox "Incorrect password"
   exit sub
end if
' of course in your case you would do the validation based on some sort of 
' user database, not the static values admin and secret

If the login is correct, you would close the login form and load the quiz form

load frm_quiz
unload frm_login     ' this was the old way of doing it in VB 4,5,6
frm_quiz.activate

This assumes, that you have named your forms frm_quiz and frm_login. In addition it assumes the field names in the login form to be txt_field_login and txt_field_passwd. Adapt that to what you have.

Hope this still works in VB2008. Attention: none of this has been tested in my developer environment. It is just typed into the forum editor.

If password = txtpasssword.text and username = txtusername.text
then 
me.dipose
mainForm.show
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.