Login
Register
Tutorials
Forum
Career Development
Resources
Reviews
Jobs
Interview
Communities
Projects
Training
Silverlight Games
|
Bookmarks
|
New Members FAQ
|
Mentor
|
Code Converter
|
IT Companies
|
Peer Appraisal
|
Members
|
Revenue Sharing
|
Computer Jokes
|
New Posts
|
Social
|
Talk to Webmaster Tony John
Online Members
naveensanagasetti
lily
Padma
prabhakar
Nitin Soni
abhinav
Prabu
Celine liyon
Ranipriya
More...
Forums
»
.NET
»
Visual Studio
»
login form in C#
Posted Date:
27 Jul 2008
Posted By::
CRPRAJAN
Member Level:
Gold
Member Rank:
939
Points
: 1
Responses:
2
I am creating a windows login form in visual C# with two textboxes one for accepting the username and other for accepting the password and one button control. I am setting the username as "Rajan" and password as "Admin".
I need to implement the following conditions in my login form.
i)While typing the username, i want the first character alone to get changed into CAPS automatically.
ii)If either the username or the password is wrong then i should get a message box "Invalid login". Else i should get the message "Login Successful".
iii)The application has 2 forms - Form2 and Form3. If the user enters with the "Admin" password then the Form2 should be displayed. Else if the user enters with the password "Guest" then the Form 3 should be displayed. How to do the validation in code.
Can anybody provide the full code?
Tweet
Responses
#270857 Author:
pradipta
Member Level:
Gold
Member Rank:
0
Date: 27/Jul/2008 Rating:
Points
: 6
Private Sub txtLogin_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtLogin.TextChanged
Dim str As String = txtLogin.Text
If (str.Length > 0) Then
txtLogin.Text = str.Substring(0, 1).ToUpper() & str.Substring(1, str.Length - 1).ToLower
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If txtLogin.Text.Equals("Rajan") AndAlso (txtPassword.Text.Equals("Admin") Or txtPassword.Text.Equals("Guest")) Then
MessageBox.Show("Login Successful")
If (txtPassword.Text.Equals("Admin")) Then
Form2.Show()
Else
Form3.Show()
End If
Else
MessageBox.Show("Invalid Login")
End If
End Sub
#271598 Author:
Raghuramakarthikeyan
Member Level:
Gold
Member Rank:
1849
Date: 28/Jul/2008 Rating:
Points
: 6
using System.Windows.Forms;
Private Sub txtLogin_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
{
if(textbox1.text!="" && textbox2.text!="")
{
textbox1.Text = str.Substring(0, 1).ToUpper();
if(textbox1.text=="Rajan")
{
if(textbox2.text=="Admin")
{
Form2.Show();
}
else if(textbox2.text=="Guest")
{
Form3.Show();
}
else
{
MessageBox.Show("Invalid Login")
}
}
else
{
MessageBox.Show("Invalid Login")
}
}
}
this will help you
Post Reply
This thread is locked for new responses. Please post your comments and questions as a
separate thread
.
If required, refer to the URL of this page in your
new post
.
Tweet
Next :
what r various life cycle model in s/w development
Previous :
conversion of char* to system::string in vc++ 2005
Return to Discussion Forum
Post New Message
Category:
Related Messages
visual source safe
* .XmlSerializers.dll
Urgent-Guys-Refreshing Datagrid on the network ?
Urgent-Guys-Refreshing Datagrid on the network ?
How to create Dll fines
Active Members
Today
baskar
(71)
Asheej T K
(49)
naveensanagase...
(29)
Last 7 Days
baskar
(366)
Ultimaterengan
(292)
Asheej T K
(195)
more...
Awards & Gifts
Email subscription
.NET Jobs
.NET Articles
.NET Forums
Articles Rss Feeds
Forum Rss Feeds