-2

I'm basically using a program i made myself, it's a program that requires a password to open w/e application i've assigned it too. But i don't know how to make the text into * instead of regular text. It's just a console program.

viggo 123
  • 27
  • 1

1 Answers1

-5
    //read from here
    private void Form1_Load(object sender, EventArgs e)
    {
        //changes whatever you type into your textbox to be an asterisk 
        textBox1.PasswordChar = '*'; 
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {
          //ignore this method
    }

    private void button1_Click(object sender, EventArgs e)
    {
        //Just to validate that the text is what you want it to be
        string text = textBox1.Text;
        MessageBox.Show(text);
    }
ragerory
  • 1,360
  • 1
  • 8
  • 27
Zizi
  • 1
  • Sorry if the code is a bit messy. I just came up with a quick solution. Practically it's correct, but definitely isn't good programming. – Zizi May 29 '15 at 19:47
  • 2
    He appears to be using a console application though. So this won't work. – Icemanind May 29 '15 at 19:48
  • A good answer is not only a working answer but also understandable. The goal is that the OP actually learns something from an answer instead of mindlessly applying it. – ShellFish May 29 '15 at 19:51
  • you're right. my bad. I may have found a link that can help you..http://stackoverflow.com/questions/3404421/password-masking-console-application – Zizi May 29 '15 at 19:52