CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2012
    Posts
    2

    Using a CheckBox with a log in GUI

    I am just beginning C Sharp and I am currently focused on GUI creation. I am making a "log in" page for a program that would require you to log in to use it. Of course its offline since I am not done with it, so any "username" "password" combination would work, but I can't get the checkbox to save the information from the usernameBox or the passwordBox when I press the rememberBox (check box). Here's what I got so far.

    Code:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    
    namespace MichPierce
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
            //Programing the Close button to close when clicked.
            private void closeButton_Click(object sender, EventArgs e)
            {
                Close();
            }
            //Programming the Log In button to populate characters into username/password boxes.
            private void loginButton_Click(object sender, EventArgs e)
            {
                usernameBox.Text = "m1tal1k";
                passwordBox.Text = "*********";
            }
            //Reset button clears the username/password boxes.
            private void resetButton_Click(object sender, EventArgs e)
            {
                usernameBox.Text = "";
                passwordBox.Text = "";
            }
        }
    }

  2. #2
    Join Date
    Jul 2012
    Posts
    2

    Re: Using a CheckBox with a log in GUI

    Also I am using Visual Studos 2012.

  3. #3
    Arjay's Avatar
    Arjay is offline Moderator / EX MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    13,490

    Re: Using a CheckBox with a log in GUI

    If you need the username/password info to persist between different times of using the app, you are going to need to write that functionality yourself. Typically, you'll encrypt the data and save it to a settings file or the registry. Then when the login dialog appears, you'll read the data back out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured