I have two radio buttons side by side in my forms and one of them generates a random password when clicked which is fine but how do I get it to, if clicked again (while already checked) it runs the code again, this isn't an issue with my code so none is required, its more of a question with visual studio's winforms radio button. Thanks in advance
private void NAPOCustom_CheckedChanged(object sender, EventArgs e) //Weird radiobutton name i know
{
NAPasswordE.Clear(); //text box which generation password goes into
string validChars = "ABCDEFGHJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*?_-";
Random random = new Random();
char[] chars = new char[12];
for (int i = 0; i < 12; i++)
{
chars[i] = validChars[random.Next(0, validChars.Length)];
}
NAPasswordE.Text = new string(chars);
}
I click the radiobutton
Desired Output: random string (this works)
I click the same radiobutton again
Desired Output: random string but different to first one (doesnt work)