Activity Stream
48,167 MEMBERS
6959 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Results 1 to 4 of 4
  1.     
    #1
    ლ(ಠ益ಠლ)
    Website's:
    extremecoderz.com

    Default [c#] simple login box with logic

    This little example shows how to create objects without the use of the Design view, how to position the items, how to use the items, using objective programming and making use of returned results.

    Hope it helps a few on the way.


    PHP Code: 
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace 
    WindowsFormsApplication9
    {
        public 
    partial class Form1 Form
        
    {
            public 
    Form1()
            {
                
    InitializeComponent();
            }

            private 
    void Form1_Load(object senderEventArgs e)
            {
                
    this.Size = new Size(170200);
                
    DrawObjects();
            }

            private 
    void DrawObjects()
            {
                
    // draw some controls
                
    TextBox uname = new TextBox();
                
    uname.Name "uname_tb";
                
    uname.Location = new Point(2020);
                
    uname.Size = new Size(10023);
                
    this.Controls.Add(uname);

                
    TextBox pword = new TextBox();
                
    pword.Name "pwd_tb";
                
    pword.Location = new Point(2053);
                
    pword.Size = new Size(10023);
                
    this.Controls.Add(pword);

                
    Button button1 = new Button();
                
    button1.Location = new Point(2086);
                
    button1.Size = new Size(10023);
                
    button1.Click += new EventHandler(button_click);
                
    button1.Text "Login";
                
    this.Controls.Add(button1);

                
    Label myLabel = new Label();
                
    myLabel.Name "statusLabel";
                
    myLabel.Location = new Point(20119);
                
    myLabel.Text "Ready.";
                
    this.Controls.Add(myLabel);
            }

            private 
    void button_click(object senderEventArgs e)
            { 
                
    // create some controls so we can access them.
                
    TextBox uname = new TextBox();
                
    TextBox pwd = new TextBox();
                
    Label status = new Label();

                
    // for each control in this forms controls
                
    foreach (Control control in this.Controls)
                {
                    if (
    control is TextBox)
                    {
                        if (
    control.Name == "uname_tb")
                            
    uname = (TextBox)control;
                    if (
    control.Name == "pwd_tb")
                            
    pwd = (TextBox)control;
                    }

                    if (
    control is Label)
                    {
                    if (
    control.Name == "statusLabel")
                            
    status = (Label)control;
                    }
                }

                
    // get the value of the boolean object "checkLogin"
                // with these details, and store the returned output
                // in a boolean form.
                
    Boolean output checkLogin(uname.Textpwd.Text);

                
    // if the result of "checkLogin"....
                
    if (!output)
                    
    status.Text "false";
                else
                    
    status.Text "true";
            }

            private 
    bool checkLogin(string usernamestring password)
            {
                
    // if the username and password are correct.
                
    if (username == "jayfella" && password == "letmein")
                    return 
    true;

                else return 
    false;

            }
                

        }

    jayfella Reviewed by jayfella on . [c#] simple login box with logic This little example shows how to create objects without the use of the Design view, how to position the items, how to use the items, using objective programming and making use of returned results. Hope it helps a few on the way. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; Rating: 5

  2.   Sponsored Links

  3.     
    #2
    Member
    uhm, I don't understand what each lines does. So lost ....

  4.     
    #3
    Teh GFX Whore! ^.^
    yes..this is really simple. I know this much C++ so could understand you this time


    I joined KWWHunction before it was cool!
    My "AWESOME" Graphic designing Service


  5.     
    #4
    Banned
    Its simple hardcoded username and passwords.. its just like entering two words and comparing them with two predefined words..

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. LOGICUBIKS - new IPhone logic game
    By layla8540 in forum General Discussion
    Replies: 0
    Last Post: 8th Sep 2011, 05:51 PM
  2. Cant Login My Msn :(
    By -zAAz- in forum Technical Help Desk Support
    Replies: 12
    Last Post: 22nd Apr 2011, 07:52 AM
  3. Can't login
    By c0rrupt in forum IP.Board
    Replies: 16
    Last Post: 17th Nov 2010, 01:47 AM

Tags for this Thread

BE SOCIAL