I need some help with creating objects while the program is running. I've noticed that when i am not running the program, when I drag(create) an object on the form, the program automatically makes some code in the "Windows Form Generated Code" region, that resembles "Friend WithEvents ObjectName bla bla bla" among other code below it. I need a way to click a button and have a NEW picturebox appear in the form, and at the same time, add all that code to the Windows Form Generated Code. Is there a way to do this? Thanks.
You have to create an object of the picture box specifying all the properties and it will be placed on the form. Something like Dim x as new PictureBox then specify the left,top .... all the prop of x and it should be fine. If you want to add the events you can do that by making a dummy PictureBox and create an object of type picture box.
I did what you said, but I still don't see a picturebox appearing on the form when I click the button where I have dim x as new PictureBox x.top = ... and the rest of the properties and nothing seems to happen.