+ 1
Why aren't there UserControl tutorials in SoloLearn?? 😂😂
it would be very nice to have tutorials for the use of UserControls on the tutorials here in SoloLearn. i am helping a few college students with a class i took like a year and half ago, but the professor started giving them new, fancy stuff like UserControls 😂😂 but i am still having some problems with the functionality of some buttons inside UserControls in Form1 for example. I am searching everywhere but i don't find what i need to do... so i guess i'll have to keep searching. 😅
7 Réponses
+ 1
Yes you need classes for this.
+ 1
Yes, i am currently using a Windows Form Application in C#. I am trying to build a Cash Register and having some problems with the UserControls. For each button on the left, there is a different category of products, and in each product window, there are several buttons, one for each product. That User Control was added to the main form, but because it is a UserControl and is not part entirely of the main form, i have problems coding de buttons. At first, the buttons were placed on the main form and it was relatively easy to program them, but when added into the UserControl and the UserControl to the main form, they cannot be programed in the main form and when trying to program them in the UserControl, i am having problems using the variables of the main form and the richTextBox of the main form... i think i have to do that with classes but i am not yet sure... been trying to see videos and reading for 2 days now and haven't found much yet... at least not the answer i am looking for.
+ 1
Thank you for your answer.
This is far more specific that I expected.
You should use classes and properties
https://www.c-sharpcorner.com/UploadFile/7d3362/user-control-in-C-Sharp/
Do you have the code off the user controls ?
+ 1
Sorry, tried to be specific so the question could be understandable 😅
In the UserControls i am using simple code, like the same code on the main form, because i am using the UserControl on the main form, but cannot access variables of the main form nor the richTextBox. And i can't program the buttons on the main form because the UserControls counts as a whole on the maun form, can't take pieces of the UserControl and program them.
My questions is that i assume i have to use classes on the proyect so i can use those variables and the richTextBox on the UserControl.
+ 1
By the same code i mean the code of the product buttons.
+ 1
Thanks for the help! I will implement what i learned here on the classes. I hope i can find the solution for this exact issue.
0
What do you want to know about which user controls ?
Do you use winforms ?