Click here to Skip to main content
15,888,351 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

I have created a form in c#.net and added controls on it. I wrote code for the controls but now the controls are not visible on form, still the code is present. The control designer code is also present in designer file. All controls visible property is set to true.
Can anybody tell please me how to show controls on form? It's urgent.

Thanks in advance
Posted
Updated 27-Jan-11 22:48pm
v3
Comments
Manas Bhardwaj 28-Jan-11 4:48am    
removed URGENTZ tag.

Here are a couple more things to check out:
1. If they are custom controls, you may need to handle the painting of them yourself.
2. If they inherit other UserControls, you may have overridden the OnPaint() and not called the base function.
3. Maybe the controls are behind another control: try using BringToFront() on the controls to see if any appear when you run the app.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 28-Jan-11 10:21am    
Not bad, but before looking at OP's code I would not be 100% sure the lost controls are really added. I saw some cases when somebody declare and instantiatr control in code without ever setting up it's parent. In design mode the designer does it for you though.
--SA
JOAT-MON 28-Jan-11 13:47pm    
Agreed! That is why I began to think that the OP had custom controls. I did not put the adding of the control in there since Theingi Win had already suggested it, but it would be highly likely. :)
Sergey Alexandrovich Kryukov 28-Jan-11 14:22pm    
Good! Let's see if OP follows up.
--SA
Could they be in a container which is invisible (Visible set to false)? Do a search for "visible", see if it is cleared anywhere in the code.
 
Share this answer
 
Comments
curious_mind 28-Jan-11 3:36am    
visible property is set already set to true
If what indivara said doesn't work then go to the designer code, and search for location property of the control. Try to set it to Point(0, 0). If you can see your control now, then it means your controls are placed out of the form boundary. Try to fix them.

All the best.
 
Share this answer
 
Comments
curious_mind 28-Jan-11 3:35am    
@ pravin:- all controls locations are already set at(0,0) still error
Pravin Patil, Mumbai 28-Jan-11 5:01am    
Can you show some code..
Rahul Ramteke, Cognizant 1-Feb-11 1:12am    
What does your solution do pravin..?
I could not understand it.
You should check your invisible control add function is exists in designer.cs file .
for example, your invisible control = btnCal7;
this.Controls.Add(this.btnCal7);



Best Regards,

Theingi Win
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900