PDA

View Full Version : Little prob in VB.Net


Marwan
04-18-04, 10:52 PM
Create a login form that has text boxes for entering a user name and password. Identified each with a label. Add OK and Cancel buttons to the form. The OK button should be disabled. Write code in the Change events of both text box controls so that if both the username and the password boxes are not a zero length string ( = "") then the OK button should be enabled. When the user clicks the OK button, the application should show a second form that represent the screen the user would see after logging in.


I have an assignment and i cant figure iut how to change the evnt... i need a lol push up please

schiavo
05-02-04, 09:41 PM
I may not understand what exactly it's doing that you don't like, but here's how to make it do what you described:
==============================
Private Sub txtUsId_TextChanged(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles txtUsId.TextChanged
If txtUsId.Text = "" And txtPswd.Text = "" Then
btnSubmit.Enabled = False
btnCancel.Enabled = False
Else
btnSubmit.Enabled = True
btnCancel.Enabled = True
End If
End Sub

Private Sub btnSubmit_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSubmit.Click
' just for this example, the form it opens is another of itself.
Dim NuForm As New Form1()
NuForm.Show()
End Sub
===========================================
Create a login form that has text boxes for entering a user name and password. Identified each with a label. Add OK and Cancel buttons to the form. The OK button should be disabled. Write code in the Change events of both text box controls so that if both the username and the password boxes are not a zero length string ( = "") then the OK button should be enabled. When the user clicks the OK button, the application should show a second form that represent the screen the user would see after logging in.


I have an assignment and i cant figure iut how to change the evnt... i need a lol push up please