Input/Output Problems in Win. Apps.

[b][red]This message was edited by sbugig at 2004-4-30 1:44:18[/red][/b][hr]
[b][red]This message was edited by sbugig at 2004-4-30 0:17:6[/red][/b][hr]
Hi I'm Sbu In RSA:

I want the C# code for reading input and displaying output from and to windows application controls such as TextBoxes:
I want to globaly declare a "password" and "user name" as constants, and use them to authenticate the user in a windows form, compare the entered values against the declared variables with out using data bases:
Actually I want an event hendler for the button control that is clicked to maybe "login"
I'm new to C# I'm still a student doing programming in C++, but I want to learn C# on my own, I'm using the .NET framework.
Your help will be appreciated


  • Here is an example of a global declaration:

    public class Global
    /* It is generally accepted that constants are given capitals
    the 'const' keyword can be used to denote a constant
    the strings declared below are private by default although you
    can add 'private' keywords to them if you want. The strings are
    global because they are not inside any methods and so are available
    to the whole class. */
    const string PASSWORD = "";
    const string USERNAME = "";

    To authenticate the users input then a simple condition must be set up:

    // all of this code should be put inside the buttons event handler
    if(txtBox1.Text = PASSWORD)
    ...// load next screen/form [login]

    ...//show error message

    For more info on event handlers check out MSDN -

    Hope this helps.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion