login form creation

how to create login form in c# language

Page 1 of 1

2 Replies - 7958 Views - Last Post: 08 February 2010 - 10:49 AM Rate Topic: -----

#1 Guest_asha*


login form creation

Posted 08 February 2010 - 02:08 AM

i want to know th how we can create the login form in c# language,each step i want to know.
Is This A Good Question/Topic? 0

Replies To: login form creation

#2 TravisP   User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 35
  • Joined: 06-January 10

Re: login form creation

Posted 08 February 2010 - 03:33 AM

Step 1:

Add a new form to your project.

Step 2:

Add a button to the form, along with 2 textboxes (for username and password).

Step 3:

Create a new action for when the button is clicked.

Step 4:

Create the code that will determine whether the username is valid or not (and whether to go to the next form, your main program form).

A simple way would be to use "if".

if ((textbox1.Text == "bob") && (textbox2.Text == "pass"))
// show new form and close the login form

Step 5:

Refine step 4, adding in try/catch scenarios and whatever else you want to add in.

Also consider that hardcoding solutions like this isn't best practice, but I think it covers the concept rather well. (ie, you don't want to have to add the if code statement for each username/password).

For the record, for future help you'll need to post code showing some effort on your behalf if you want actual code.

This post has been edited by TravisP: 08 February 2010 - 03:35 AM

Was This Post Helpful? 0
  • +
  • -

#3 MentalFloss   User is offline

  • .
  • member icon

Reputation: 595
  • View blog
  • Posts: 1,550
  • Joined: 02-September 09

Re: login form creation

Posted 08 February 2010 - 10:49 AM

Just as a side note, if you're using ASP.NET, there is already an entire authentication control you can simply slap on the page.
If it's windows forms, then TravisP explains it well enough.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1