I'm setting an MYSQL query for Dynamic button, I want to set click a button to load another table
I had tried inside foreach
- button.Name = dr[0].ToString();
and for loop
but not work
- foreach (DataRow dr in dt.Rows)
- {
- Button button = new Button();
- button.FlatStyle = FlatStyle.Flat;
- button.BackColor = Color.Gold;
- button.Text = dr[1].ToString();
- button.Name = dr[0].ToString();
- button.Font = new Font("Microsoft Sans Serif", 25, FontStyle.Bold);
- button.Size = new Size(300, 50);
- button.Left = left;
- button.Top = top;
- panel1.Controls.Add(button);
- top += button.Height + 2;
-
- }
- }
-
- private void madeReq_frm_Load(object sender, EventArgs e)
- {
- AddButtons();
- }
-
-
- private void C00001_Click()
- {
-
- MessageBox.Show("Load DataBase 1");
-
- }
How can i to fix ? Thank you