/*Elotte sokszar*/ button8.Visible = false; //register button9.Visible = false; //login button7.Visible = false; //adminpanel button11.Visible = true; //logout button6.Visible = true; //csillag button13.Visible = true; //settings OleDbConnection c = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data source='db.mdb'"); OleDbDataAdapter a = new OleDbDataAdapter(); try{ c.Open(); OleDbCommand s = new OleDbCommand("SELECT * FROM Bookmarks WHERE login = '" + op.nev + "'",c); OleDbDataReader r = s.ExecuteReader(); OleDbCommand s1 = new OleDbCommand("SELECT COUNT(*) FROM Bookmarks WHERE login = '" + op.nev + "' AND btype = 'Elektrotechnika'",c); int x = Convert.ToInt32(s1.ExecuteScalar()); MessageBox.Show(Convert.ToString(x)); tbnev = new string[x]; tburl = new string[x]; tbdate = new string[x]; while(r.Read()){ tbnev[db] = r.GetString(2); tburl[db] = r.GetString(3); tbdate[db] = r.GetString(4); db++; } r.Close(); int poz = 113; foreach (string index in tbnev) { Button button = new Button(); button.Location = new System.Drawing.Point(poz, 6); button.Name = index; button.Size = new System.Drawing.Size(75, 23); button.TabIndex = 0; button.Text = index; button.UseVisualStyleBackColor = true; button.Click += new System.EventHandler(Button14Click); // Itt kene atadni az tburl tombot, nem? poz += 90; panel1.Controls.Add(button); } }catch(Exception ex){ MessageBox.Show("hiba"+ ex); } /* EVENT */ void Button14Click(object sender, EventArgs e) { MessageBox.Show(sender.ToString()); }