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();
- for (int i =1; i<10;i++)
- foreach (DataRow dr in dt.Rows)
- {
- Button button = new Button();
- button.FlatStyle = FlatStyle.Flat;
- button.BackColor = Color.Gold;
- button.Text = dr[1].ToString(); // Load item name
- button.Name = dr[0].ToString(); //Load item PK
- 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); // here
- top += button.Height + 2;
- }
- }
- private void madeReq_frm_Load(object sender, EventArgs e)
- {
- AddButtons();
- }
- private void C00001_Click() //DB TABLE PK NAME C00001
- {
- MessageBox.Show("Load DataBase 1");
- }
Ronika JencyPosted Jun 11, 2019, 7:17 AM
Sivakumar KonetiPosted Jun 11, 2019, 3:15 AM