So I have 2 picture boxes, a textbox, and a button. One of the picture boxes adds another row with the same controls but moved down when clicked and the other picture box (should) remove the same row that it was clicked on. I have PictureBoxAdd1, PictureBoxRemove1, TextBox1, and Button1 set up by default and when PictureBoxAdd1 is clicked, it adds 1 at the end of the name properties. Now, how do I remove the appropriate row when PictureBoxRemove is clicked? Say I have 5 rows (but the amount of rows available will depend on how many PictureBoxAdd was clicked), if I click on PictureBoxRemove4, then PictureBoxAdd4, PictureBoxRemove4, TextBox4, and Button4 should be removed all together. Any help would be greatly appreciated.
Jump to Post
See if this helps.
Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load '// when adding new row of controls, add a Handler for your PictureBoxRemove. AddHandler PictureBoxRemove1.Click, AddressOf PictureBoxRemove_Click 'AddHandler PictureBoxRemove2.Click, AddressOf PictureBoxRemove_Click 'AddHandler PictureBoxRemove3.Click, AddressOf PictureBoxRemove_Click End Sub Private …
All 3 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.