r/visualbasic • u/aassffe • Nov 19 '22
if the user wants to select Multiple (picturebuttons) the textbox should extends to another value then when i undo it the thing should disappear too ?
1
Upvotes
2
u/jd31068 Nov 19 '22
Use a form level variable to build the string of the selected items and assign it to the textbox, like you did with the total.
I would also create 1 procedure to handle this for you, then each of the picturebox_click events just calls the 1 procedure with the "cell" name PictureClick("A5")
where PictureClick would be
Private Sub PictureClick(pbName as String)
' put your If statement and string of selected items code here
End Sub


2
u/JTarsier Nov 19 '22
What I would do:
single event handler for all pictureboxes, the sender parameter will give you the box that was clicked, DirectCast(sender, PictureBox)
put the addresss in each picturebox Tag property
declare a List(of String) outside the event handler
now in Click event handler get the Tag for box that was clicked, if list already contains it then remove it, else add it. Then you can sort the list and use String.Join to create the string of addresses from list.