Can I create a new class that inherits the PictureBox and add two new properties to it and then access those properties in my code?
Printable View
Can I create a new class that inherits the PictureBox and add two new properties to it and then access those properties in my code?
Yes you can.
Then I assume I would have to add them to my form in code - rather than from the toolbox. But I'm not sure how.
You can add it to your form from the toolbox, when you build the app your user control will be at the very top with a purple icon, just drag it to your form and it creates one for you like any other form control.
Thread moved from the 'CodeBank VB.Net' forum (which is for you to post working code examples, not questions) to the 'VB.Net' forum
(thanks for letting us know folks :thumb: )
you can either set the autotoolboxpopulate to true in Tools -> options
in windows form designer
now your new picturebox class should be in your toolbox.
or do it manually
place a picturebox on your form
select the form and be sure the show all files in the solution explorer is active...
Open the designer file and alter the
Me.PictureBox1 = New System.Windows.Forms.PictureBox
and
Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
into creating your class