Computing.Net > Forums > Programming > Login form in vb

Login form in vb

Reply to Message Icon

Original Message
Name: gardenair
Date: April 23, 2004 at 10:00:45 Pacific
Subject: Login form in vb
OS: winXp
CPU/Ram: 256
Comment:

I want to make a form where in the user shold first write his user name
& then password .If the user name and password are currect then the next
form will be load otherwise the user can't switch to nect form.
I use two button . Next & Cancel.I next button i use the following
command.

Private Sub cmdNext_Click()
If txtName.Text = sky And txtPassword.Text = 123 Then
cmdNext.Enabled = True
Form1.Hide
Form2.Show
Else
cmdNext.Enabled = False
End If
End Sub

In form Load event i use
Private Sub Form_Load()

cmdNext.Enabled = False

End Sub

When i run the form write currect name, password &press next button still
VB does't switch the next form.As well as there VB6 does't show any error
Please guide me how can't i do it.
Thnaks in advance.


Report Offensive Message For Removal

Response Number 1
Name: wheelspinner99
Date: April 23, 2004 at 10:47:30 Pacific
Subject: Login form in vb
Reply: (edit)

ok, your code looks good except for one thing. the .enabled only prevents the button from being pressed so you shouldn't be able to press the next button at all. So if you can't press the next button at all then you can't trigger the cmdNext_click. Right? What you should do is remove the .enabled from both steps. Then something like this...

cmdNext_click()
If txtName.text = "sky" and txtpass.text = "123" then
form2.show
form1.hide
else
msgbox("Incorrect user info")
txtname.setfocus
endif

remember, if you use literal values like sky you must enclose them in "quotes". Otherwise VB tries to find variable values, but i'm sure you knew that. Hope this helps! BTW: when switching to another form always load the next screen first and hide the screen you are leaving after. this prevents screen flickering.


Report Offensive Follow Up For Removal

Response Number 2
Name: gardenair
Date: April 23, 2004 at 13:43:58 Pacific
Subject: Login form in vb
Reply: (edit)

Thnaks nick for your nice help.Iam sure that this code will work. Again thanks that u guide me in a good & nice way.


Report Offensive Follow Up For Removal

Response Number 3
Name: wheelspinner99
Date: April 23, 2004 at 22:21:04 Pacific
Subject: Login form in vb
Reply: (edit)

No problem, i too hate when people act like jerks and give no help. Let us know if it doesn't work out, we'll work on it some more!


Report Offensive Follow Up For Removal

Response Number 4
Name: gardenair
Date: April 24, 2004 at 02:45:52 Pacific
Subject: Login form in vb
Reply: (edit)

Again thanks ..bundle of thnaks nick. The code is working properly .U have solved my big problem .Iam so much happy & thankful for your kind co-operation. Again 1000000 times thanks
With best regards.


Report Offensive Follow Up For Removal







Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Login form  in vb

Comments:

 


  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 
Data Recovery Software