Click here to Skip to main content
15,890,557 members
Home / Discussions / C#
   

C#

 
QuestionTrouble with TypeConverter/TypeDescriptor Pin
Nathan Ridley14-Apr-07 19:10
Nathan Ridley14-Apr-07 19:10 
AnswerRe: Trouble with TypeConverter/TypeDescriptor Pin
Christian Graus14-Apr-07 20:24
protectorChristian Graus14-Apr-07 20:24 
GeneralRe: Trouble with TypeConverter/TypeDescriptor Pin
Nathan Ridley15-Apr-07 16:20
Nathan Ridley15-Apr-07 16:20 
QuestionDataGridView RowHeader Text Pin
freshonlineMax14-Apr-07 18:54
freshonlineMax14-Apr-07 18:54 
QuestionNeed Help With Win Forms Pin
DRAYKKO14-Apr-07 16:07
professionalDRAYKKO14-Apr-07 16:07 
AnswerRe: Need Help With Win Forms Pin
Muammar©14-Apr-07 19:29
Muammar©14-Apr-07 19:29 
AnswerRe: Need Help With Win Forms Pin
Christian Graus14-Apr-07 21:06
protectorChristian Graus14-Apr-07 21:06 
GeneralRe: Need Help With Win Forms Pin
DRAYKKO14-Apr-07 22:53
professionalDRAYKKO14-Apr-07 22:53 
private void OK_Click(object sender, EventArgs e)
        {
            //use this to confirm that the user is valid
           Main userAuthentication = new Main();

            userAuthentication.AuthenticUser = CheckUser();

            if (userAuthentication.AuthenticUser)
            {
                this.Close();
            }
            else 
            {
                if (Tries < 2)
                {
                    MessageBox.Show("That was an invalid user name or password. Try again...");
                    ++Tries;
                    CheckUser();
                }
                else
                {
                    userAuthentication.AuthenticUser = false;
                    this.Close();
                }
            } 
        }

        public bool CheckUser()
        {
            //testing number of tries
            //string numberOfTries = string.Format("tries = {0}", Tries);
            //MessageBox.Show(numberOfTries);

            if ((usernameTextBox.Text == "User1") && (passwordTextBox.Text == "User1"))
                return true;
            else if ((usernameTextBox.Text == "User2") && (passwordTextBox.Text == "User2"))
                return true;
            else
            {
                usernameTextBox.Text = "";
                passwordTextBox.Text = "";
                usernameTextBox.Focus();
                return false;
            }
        }


This code, from the Logon form, is supposed to alert the Main form whether the user typed in a valid username and password. And when I "trace" it, it does set AuthenicUser to true. But it seems that when I close the logon form the property reverts back to false (and I'm not sure why).

BTW: Is there a way to send attachments here?


=======================
Every experience in life is a lesson to be learned

A. Stevens
B.S., Computer Science

GeneralRe: Need Help With Win Forms Pin
Christian Graus15-Apr-07 0:04
protectorChristian Graus15-Apr-07 0:04 
GeneralRe: Need Help With Win Forms Pin
DRAYKKO15-Apr-07 5:24
professionalDRAYKKO15-Apr-07 5:24 
QuestionHow get an Array with the EnumValues from a FlagEnum-Value Pin
MarkPhB14-Apr-07 12:48
MarkPhB14-Apr-07 12:48 
AnswerRe: How get an Array with the EnumValues from a FlagEnum-Value Pin
Luc Pattyn14-Apr-07 13:31
sitebuilderLuc Pattyn14-Apr-07 13:31 
GeneralRe: How get an Array with the EnumValues from a FlagEnum-Value Pin
MarkPhB15-Apr-07 1:12
MarkPhB15-Apr-07 1:12 
AnswerRe: How get an Array with the EnumValues from a FlagEnum-Value Pin
Scott Dorman14-Apr-07 14:23
professionalScott Dorman14-Apr-07 14:23 
GeneralRe: How get an Array with the EnumValues from a FlagEnum-Value Pin
MarkPhB15-Apr-07 2:54
MarkPhB15-Apr-07 2:54 
QuestionAcces an ArrayList from multiple threads Pin
crazy friend14-Apr-07 9:00
crazy friend14-Apr-07 9:00 
AnswerRe: Acces an ArrayList from multiple threads Pin
Luc Pattyn14-Apr-07 12:46
sitebuilderLuc Pattyn14-Apr-07 12:46 
QuestionIs is possible to change the setting of the ContextMenu? Pin
Khoramdin14-Apr-07 8:49
Khoramdin14-Apr-07 8:49 
AnswerRe: Is is possible to change the setting of the ContextMenu? Pin
Luc Pattyn14-Apr-07 12:51
sitebuilderLuc Pattyn14-Apr-07 12:51 
QuestionRe: Is is possible to change the setting of the ContextMenu? Pin
Khoramdin15-Apr-07 7:27
Khoramdin15-Apr-07 7:27 
AnswerRe: Is is possible to change the setting of the ContextMenu? Pin
maryamf14-Apr-07 22:48
maryamf14-Apr-07 22:48 
QuestionRe: Is is possible to change the setting of the ContextMenu? [modified] Pin
Khoramdin15-Apr-07 6:05
Khoramdin15-Apr-07 6:05 
Questionshow array elements Pin
ahmad al-omar14-Apr-07 6:21
ahmad al-omar14-Apr-07 6:21 
AnswerRe: show array elements Pin
Thomas Stockwell14-Apr-07 6:37
professionalThomas Stockwell14-Apr-07 6:37 
GeneralRe: show array elements Pin
Colin Angus Mackay14-Apr-07 6:55
Colin Angus Mackay14-Apr-07 6:55 

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.