Click here to Skip to main content
15,887,596 members
Home / Discussions / C#
   

C#

 
AnswerRe: ADO.NET 4 SqlConnection SqlDataAdapter Pin
Pete O'Hanlon25-Oct-12 23:55
mvePete O'Hanlon25-Oct-12 23:55 
GeneralRe: ADO.NET 4 SqlConnection SqlDataAdapter Pin
devvvy26-Oct-12 2:58
devvvy26-Oct-12 2:58 
GeneralRe: ADO.NET 4 SqlConnection SqlDataAdapter Pin
Eddy Vluggen26-Oct-12 3:33
professionalEddy Vluggen26-Oct-12 3:33 
GeneralRe: ADO.NET 4 SqlConnection SqlDataAdapter Pin
devvvy28-Oct-12 20:00
devvvy28-Oct-12 20:00 
AnswerRe: ADO.NET 4 SqlConnection SqlDataAdapter Pin
Simon_Whale26-Oct-12 0:31
Simon_Whale26-Oct-12 0:31 
Question[Help] Sending message automatically Pin
askersuku25-Oct-12 19:18
askersuku25-Oct-12 19:18 
AnswerRe: [Help] Sending message automatically Pin
Pete O'Hanlon25-Oct-12 23:51
mvePete O'Hanlon25-Oct-12 23:51 
QuestionTextBox not recognising Input Pin
chappie425-Oct-12 14:43
chappie425-Oct-12 14:43 
I have downloaded the following code to work from for an app which requires login and registration.

http://code.msdn.microsoft.com/windowsdesktop/CCS-LABS-C-Creating-a-9ba05613/view/Discussions[^]

When I run the code and wish to register I enter my registration details and when I Click on register the MessageBox appear with note "Username can not be empty."
But there is text in the box.

Any suggestions?

Below is the code for the registration form.

C#
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 ccslabsLogIn.forms
{
    public partial class frmRegister : Form
    {

        #region "Properties"

        private bool _Registered = false;

        public bool Registered
        {
            get { return _Registered; }
            set { _Registered = value; }
        }
        private string _Username = "";

        public string Username
        {
            get { return _Username; }
            set { _Username = value; }
        }

        #endregion

        public frmRegister()
        {
            InitializeComponent();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Registered = false; // tell calling form the user DID NOT register
            this.Close(); // close the form
        }

        // register the dude.
        private void btnRegister_Click(object sender, EventArgs e)
        {
            RegisterUser();
        }

        // Register the User
        private void RegisterUser()
        {
            if (tbUsername.Text.Length > 0) // You may want longer than 1 char minimum for usernames
            {
                if (tbPassword.Text != tbRepeatPassword.Text) { MessageBox.Show("Passwords do not match"); RegisterUser(); } // passwords do not match retry
                // ok passwords do match are they empty?
                if (tbPassword.Text.Length == 0) { MessageBox.Show("Passwords can not be empty"); RegisterUser(); } // empty passwords try again!
                // Ok username and passwords are valid.
                // register the user !
                usersTableAdapter.Insert(tbUsername.Text, tbPassword.Text);
                Registered = true;
                this.Close();
            }
            MessageBox.Show("Username can not be empty");
            RegisterUser();
        }

        private void usersBindingNavigatorSaveItem_Click(object sender, EventArgs e)
        {
            this.Validate();
            this.usersBindingSource.EndEdit();
            this.tableAdapterManager.UpdateAll(this.applicationDataSet);

        }

        private void frmRegister_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'applicationDataSet.Users' table. You can move, or remove it, as needed.
            this.usersTableAdapter.Fill(this.applicationDataSet.Users);

        }
    }
}


Thank you very much.
AnswerRe: TextBox not recognising Input Pin
Eddy Vluggen25-Oct-12 15:08
professionalEddy Vluggen25-Oct-12 15:08 
GeneralRe: TextBox not recognising Input Pin
chappie425-Oct-12 15:15
chappie425-Oct-12 15:15 
GeneralRe: TextBox not recognising Input Pin
Manfred Rudolf Bihy26-Oct-12 0:29
professionalManfred Rudolf Bihy26-Oct-12 0:29 
GeneralRe: TextBox not recognising Input Pin
Eddy Vluggen26-Oct-12 1:42
professionalEddy Vluggen26-Oct-12 1:42 
Questionextension method Pin
mhd.sbt25-Oct-12 9:52
mhd.sbt25-Oct-12 9:52 
AnswerRe: extension method Pin
Pete O'Hanlon25-Oct-12 10:07
mvePete O'Hanlon25-Oct-12 10:07 
AnswerRe: extension method Pin
Richard Andrew x6425-Oct-12 12:19
professionalRichard Andrew x6425-Oct-12 12:19 
AnswerRe: extension method Pin
samu4u25-Oct-12 23:53
samu4u25-Oct-12 23:53 
GeneralRe: extension method Pin
Pete O'Hanlon26-Oct-12 0:14
mvePete O'Hanlon26-Oct-12 0:14 
GeneralRe: extension method Pin
mhd.sbt26-Oct-12 0:41
mhd.sbt26-Oct-12 0:41 
Questionregarding wcf Binding and endpoint Pin
Tridip Bhattacharjee25-Oct-12 8:54
professionalTridip Bhattacharjee25-Oct-12 8:54 
AnswerRe: regarding wcf Binding and endpoint Pin
Pete O'Hanlon25-Oct-12 9:00
mvePete O'Hanlon25-Oct-12 9:00 
GeneralRe: regarding wcf Binding and endpoint Pin
Ravi Bhavnani25-Oct-12 10:13
professionalRavi Bhavnani25-Oct-12 10:13 
AnswerRe: regarding wcf Binding and endpoint Pin
Dave Kreskowiak25-Oct-12 10:26
mveDave Kreskowiak25-Oct-12 10:26 
QuestionNeed a little hint my brain is burned out Pin
Mendor8125-Oct-12 4:24
professionalMendor8125-Oct-12 4:24 
AnswerRe: Need a little hint my brain is burned out Pin
Richard MacCutchan25-Oct-12 6:25
mveRichard MacCutchan25-Oct-12 6:25 
AnswerRe: Need a little hint my brain is burned out Pin
Eddy Vluggen25-Oct-12 8:33
professionalEddy Vluggen25-Oct-12 8:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.