torisch Posted April 1, 2003 Posted April 1, 2003 Hi! I have a form where I display the contents from a table in a database. For each record in the database i dynamically generate a textbox and a button. The textbox contains the content of the record in the database and my intention is to give the user the possibility to delete the databasereccord by hitting the button. I put the dynamically generated textboxes and buttons in two arraylists, and adds them to a panel like this. Dim tb as New ArrayList() Dim btns as New ArrayList() With rdr Dim i As Integer = 0 While rdr.Read 'Adding TextBox tb.Add(New TextBox()) tb(i).text=rdr.item(1).ToString Me.Panel1.Controls.add(tb(i)) 'Adding Button btns.Add(New Button()) btns(i).text="Delete this record" Me.Panel1.Controls.add(btns(i)) i = i + 1 End While .Close() End With This is a little simplified, but I manage to generate the form as I want it to look. My problem is how to respond to a click event from the buttons. I reccon it has to be dynamically generated events for the buttons too, so that I can find which button the user have clicked. Anybody has a clue about how I can solve that? I'm using VB.NET by the way.. -- Tor Inge Schulstad NORWAY Quote
*Gurus* divil Posted April 1, 2003 *Gurus* Posted April 1, 2003 See this thread, only a few down the list from yours. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.