Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Simple C# question..

  • 16-11-2004 5:32pm
    #1
    Registered Users, Registered Users 2 Posts: 44,200 ✭✭✭✭


    Pretty standard question but after 2 years of learning Visual Basic, doing simple things is a lot more tricky in C#.

    I've 2 forms - NameScreen and Table.

    On the Form_Load of Table, i simply want to get the value that was entered into a TextBox on the NameScreen form.

    I've made a the following method to get it from the NameScreen class.
    string playerName;
    playerName = txtPName.Text;

    public string getPlayerName()
    {
    return playerName;
    }

    How would i access this method from the Form_Load of Table? Would i need to declare the variable as playerName as public also? Any help is much appreciated.


Comments

  • Closed Accounts Posts: 35 Ivan Dunaev


    Your forms are variables, instances of classes. You can get access to a method of a variable by having the reference to it.


Advertisement