Ive been having some problems with understanding the MySql reader from MySql.Data.MySqlClient
This is my Code:
while (reader.Read())
{
documentButtons = new RadioButton[3];
for (int i = 0; i < 3; i++)
{
documentButtons[i] = new RadioButton();
documentButtons[i].Text = reader["name"].ToString() + " " + (i + 1);
Console.WriteLine(reader["name"].ToString());
documentButtons[i].Location = new System.Drawing.Point(10, 10 + i * 20);
this.Controls.Add(documentButtons[i]);
}
}
Console.ReadLine();
This makes 3 radiobuttons with the texts: "Dokument1 1", "Dokument1 2", "Document1 3" As you can probably see, i want the number right behind "Dokument" to be equal to the number behind that. (My 3 first entries in the database is "Dokument1", "Dokument2" and "Dokument3". In my console, "Dokument1", 2 and 3, all show up 3 times. How can i make it create the appropriate name on the appropriate radiobutton?