Input/Output Problems in Win. Apps. - Programmers Heaven

Howdy, Stranger!

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

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Input/Output Problems in Win. Apps.

sbugigsbugig Posts: 4Member
[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:
e.g
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"
NB:
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





Comments

  • ITAITA Posts: 463Member
    Here is an example of a global declaration:

    [code]
    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 = "";
    }
    [/code]

    To authenticate the users input then a simple condition must be set up:
    e.g
    [code]

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

    else
    {
    ...//show error message
    }
    [/code]

    For more info on event handlers check out MSDN - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vborieventhandlers.asp

    Hope this helps.

    ITA
Sign In or Register to comment.