C
C#•2y ago
Warren

UserControl problem

Hi, as you can see, i created a new UserControl but when i try to drag it on my form it shows some errors, how can i make it work ? Apparently it's not because of the code himself, because i can add one manually in my flowLayoutPanel, but i cannot drag it from the toolbox without an error
14 Replies
HimmDawg
HimmDawg•2y ago
Would be really nice, if you can roughly translate this error 😄 But some information: If you drag your UserControl onto a form, the Constructor of that control is called. So maybe you have some stuff happening in your constructor
Warren
WarrenOP•2y ago
here is the code of the UserControl
Warren
WarrenOP•2y ago
and the error is : "Impossible to create componant 'listCompetItem' the error message is :" and all the paths following
Warren
WarrenOP•2y ago
HimmDawg
HimmDawg•2y ago
So your constructor contains InitializeButtons(). And in there, you are loading a bunch of different images from some paths, where the root is your StartupPath. I suppose those paths are just not found. It's better to use the images as resources in your app and then just refer to those resources
Warren
WarrenOP•2y ago
how ? i tried to add but its empty
Warren
WarrenOP•2y ago
Warren
WarrenOP•2y ago
Warren
WarrenOP•2y ago
nevermind i found it still doesn't work :c
HimmDawg
HimmDawg•2y ago
So what's wrong?
Warren
WarrenOP•2y ago
i have this error now, not the same but i still don't know what it referes to
Warren
WarrenOP•2y ago
HimmDawg
HimmDawg•2y ago
Did you do something with the constructor perhaps?
Warren
WarrenOP•2y ago
oh i just changed something and it worked in the constructor i added a variable linked to Parent of the control but somehow it compiled without telling me that on the load it doesn't have parent
Want results from more Discord servers?
Add your server