0

Hey guys i need help with this error:

Error 1 'All' is a 'variable' but is used like a 'method' 60

int Plength = 0;
            Random Generate = new Random();
            int rdmNumber = 0;
            string Password = "";
            string All = ("aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789`~!@#$%^&*()_-=+[]{};:'|/?.>,<");

 if (RB_All.Checked)
            {
                if (rbttn_eg.Checked | rbttn_tn.Checked | rbttn_tw.Checked | rbttn_tr.Checked)
                {
                    for (int i = 1; i <= Plength; i++)
                    {
                        rdmNumber = 0;
                        rdmNumber = Generate.Next(0, 93);
                        Password = Password + All(rdmNumber); 
                    }
                }
                else
                {
                    MessageBox.Show("You need to pick a length!");
                }
            }


            TxtPw.Text = Password;
        }

That is code and error is here ---> Password = Password + All(rdmNumber); at that ALL...
Please help

2
Contributors
3
Replies
6
Views
6 Years
Discussion Span
Last Post by Mitja Bonca
0

Remove brackets:

string All = "aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ0123456789`~!@#$%^&*()_-=+[]{};:'|/?.>,<";

and the for the All you have to assign index with [] brackers:

Password = Password + All[rdmNumber];

Edited by Mitja Bonca: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.