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

Recommended Answers

All 3 Replies

Remove brackets:

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

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

Password = Password + All[rdmNumber];

Thanks ;)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.