• Advertisement
Sign in to follow this  

Help with passing string

This topic is 1824 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

So i have made program that changes username nick in the main menu, but it wont work, here is the code

public void rUsername() 
    {
        string uInput;
        Console.WriteLine("Rename Your Username: ");
        uInput = Console.ReadLine();
        username = uInput;
        Console.Clear();
        Console.WriteLine("You changed your username succesfully! Press Enter To Continue...");
        Console.ReadLine();
        Console.Clear();
        initOptions();
    }

btw in class Options i have variable public string username; So what i want to do is just from this function pass it to the username that is in class, why it is not working (No Errors  btw)

Share this post


Link to post
Share on other sites
Advertisement

Why not do:

username = Console.ReadLine();

Or even:

string username;
cin >> username;
cout << username;

Besides I dont see you calling or passing your variable 'username' into your class.

Share this post


Link to post
Share on other sites

Dissipate, the OP's using C#, not C++.

The problem here is likely to be related to the 'username' variable somehow. TheScriptan, you need to give more information about how you create, access, and display that variable.

Share this post


Link to post
Share on other sites

Does your initOptions();

Change the username variable back to the default?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement