Page 1 of 1

User Control accessing Form?

Posted: Thu Jan 11, 2018 9:52 am
by hungryhounduk
Hey Coders
I haven't coded for years and I'm a little rusty

I have a usercontrol with a Picturebox on it and I have created a new Form called List with a Listbox on it
I want the form ( List) to show when I click the Picturebox on the UserControl.

I have spent about a day on it and keep getting the code wrong :(

any help would be great

Re: User Control accessing Form?

Posted: Thu Jan 11, 2018 11:58 am
by hungryhounduk
I re created the scenario using 2 forms and that worked fine,
But when using a usercontrol it throws errors

Re: User Control accessing Form?

Posted: Sun Jan 14, 2018 7:48 pm
by CodenStuff
if the usercontrol is in the same project as the form you should be able to use

in the picturebox click event...
Code: Select all
List.Showdialog()