i got some erros on this sentence:
char randomChar = validchars(idx);
private void metroButton1_Click(object sender, EventArgs e)
{
if (connected == true)
{
//*** Declaration of variables
string baseCID = null;
string validchars = null;
StringBuilder sb = new StringBuilder();
dynamic randomString = sb.ToString();
//*** Assign values to variables
baseCID = "00000001008";
validchars = "ABCDEF1234567890";
//*** Generate random string
Random rand = new Random();
for (int i = 1; i <= 21; i++)
{
int idx = rand.Next(0, validchars.Length);
char randomChar = validchars(idx);//this givs me an error
sb.Append(randomChar);
}
metroTextBox1.Text = baseCID + sb.ToString();
}
else
{
MessageBox.Show("You are Not Connected!", "Connect Please");
}
}
Aucun commentaire:
Enregistrer un commentaire