[TUT] C# How to add a Basic Password to Programs

Discussion in 'Programming General' started by Fallen Soul, Jul 15, 2008.

[TUT] C# How to add a Basic Password to Programs
  1. Unread #1 - Jul 15, 2008 at 6:43 PM
  2. Fallen Soul
    Joined:
    Mar 11, 2007
    Posts:
    746
    Referrals:
    0
    Sythe Gold:
    0

    Fallen Soul Apprentice

    [TUT] C# How to add a Basic Password to Programs

    Well in this tutorial I will teach you how to use an "if statement" to make a very very basic password for your programs.

    To start open up your Visual studio and Click Create New Project > Windows form application (Name it what ever you want)
    [​IMG]

    Go to your toolbox and add a button, and a textbox to your form.
    [​IMG]

    Double click on your button and it should open up and look like this.
    [​IMG]

    Now add this code...

    Code:
    if (textBox1.Text == ("Jaghax"))
    {
     MessageBox.Show("Correct!");
    }
    This is simply telling your program that if the word "Jaghax" is entered into your textbox , then it should show you the Messagebox.

    So far this is what you should have and what it should look like.
    [​IMG]


    Push the start button at the top, or go to Debug > Start debugging
    [​IMG]

    Something like this should popup depending on where you put your buttons and if you named them.

    [​IMG]
    Notice, if you put anything else into the textbox it does nothing. That's cause we haven't told it what to do if something else is put there.

    Now we need to tell our program what to do if some one gets the password wrong.


    Now we need to tell our program to to do if something else is put in the textbox
    Add this right below the last "}" in the "if statement"

    Code:
    else
    {
     Application.Exit();
    }
    This is telling your program to close itself if anything other word is in the textbox other then your set password

    It should now look like this
    [​IMG]

    Now open your project again and type in a different word, other then "Jaghax". If you did it right it should instantly close.

    This is the end of my tutorial, thank you for reading and if you have any questions or advice please feel free to post it. (I made this myself and I posted it on a different site but felt that it should be released here as well)
     
  3. Unread #2 - Aug 27, 2008 at 9:52 AM
  4. Chase Young
    Referrals:
    3

    Chase Young Guest

    [TUT] C# How to add a Basic Password to Programs

    Nice tutorial, I'm sure people will find it useful as I have. =)
     
  5. Unread #3 - Aug 27, 2008 at 5:08 PM
  6. Fallen Soul
    Joined:
    Mar 11, 2007
    Posts:
    746
    Referrals:
    0
    Sythe Gold:
    0

    Fallen Soul Apprentice

    [TUT] C# How to add a Basic Password to Programs

    Thanks

    I have been gone for awhile. I will write some more tuts in C# if you like.
     
  7. Unread #4 - Aug 27, 2008 at 5:30 PM
  8. Swan
    Joined:
    Jan 23, 2007
    Posts:
    4,957
    Referrals:
    0
    Sythe Gold:
    0
    Sythe's 10th Anniversary Member of the Month Winner

    Swan When They Cry...
    Retired Global Moderator

    [TUT] C# How to add a Basic Password to Programs

    No encryption? No obfuscation?

    Easy way to crack this. Open it up in a debugger, search for all referrenced text strings - and there you go ;)
     
  9. Unread #5 - Aug 28, 2008 at 2:03 AM
  10. Fallen Soul
    Joined:
    Mar 11, 2007
    Posts:
    746
    Referrals:
    0
    Sythe Gold:
    0

    Fallen Soul Apprentice

    [TUT] C# How to add a Basic Password to Programs

    Yeah but its supposed to be Basic. Its meant more for learning on how to use basic text boxes. Not meant to be used to hide your bank statements ;)

    Its also more of an If statement guide then anything.
     
  11. Unread #6 - Sep 11, 2008 at 7:58 AM
  12. x⁹
    Referrals:
    1

    x⁹ Guest

    [TUT] C# How to add a Basic Password to Programs

    If you're going to use something that basic, you should AT LEAST store the password as an md5 hash....
     
  13. Unread #7 - Sep 14, 2008 at 10:02 AM
  14. FartKnocker
    Joined:
    Sep 3, 2007
    Posts:
    285
    Referrals:
    0
    Sythe Gold:
    5

    FartKnocker Forum Addict

    [TUT] C# How to add a Basic Password to Programs

    Nice. not super secure but it's useful ^^.

    EDIT: How would I make it if the password is correct, it opens another form file?
     
  15. Unread #8 - Sep 27, 2008 at 11:45 PM
  16. x⁹
    Referrals:
    1

    x⁹ Guest

    [TUT] C# How to add a Basic Password to Programs

    use form.show() or form.showDialog()
     
  17. Unread #9 - Oct 13, 2008 at 6:58 PM
  18. FartKnocker
    Joined:
    Sep 3, 2007
    Posts:
    285
    Referrals:
    0
    Sythe Gold:
    5

    FartKnocker Forum Addict

    [TUT] C# How to add a Basic Password to Programs

    Thank you :idea: .
     
  19. Unread #10 - Dec 12, 2009 at 8:19 PM
  20. gaddiel14
    Joined:
    Dec 12, 2009
    Posts:
    1
    Referrals:
    0
    Sythe Gold:
    0

    gaddiel14 Newcomer

    [TUT] C# How to add a Basic Password to Programs

    Thanks for the tips...../ it helps me lot.....


    __________________
    Chase Auto Loan
     
  21. Unread #11 - Dec 19, 2009 at 5:46 PM
  22. Supah Fly
    Joined:
    Aug 22, 2007
    Posts:
    202
    Referrals:
    1
    Sythe Gold:
    0

    Supah Fly Active Member
    Banned

    [TUT] C# How to add a Basic Password to Programs

    or use .net reflector and find the password.
     
< Java Form | VB Tutorial set: 1. Introduction >

Users viewing this thread
1 guest


 
 
Adblock breaks this site