Click here to Skip to main content
15,905,682 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I want to create one usercontrol and have one button,one texbox and one button but my point is all content means inside the usercontrol will be enabled property false in design time.

i am using UserControl in otherform properly but my question is how to change property like enabled true and textbox and lable property also in form.

I hope you will understand what is saying?
Posted
Comments
[no name] 28-Apr-14 15:17pm    
I sure don't know what it is that you are saying. If the controls are showing as disabled at design time, that is because you have set them to be disabled. You can also set them to be enabled at runtime by setting the property to be true. If I recall correctly, you will see the user control as disabled at design time if you add it to a form. You have to look at the design view of the user control to make any changes.
Ramkrishn Mishra 28-Apr-14 16:14pm    
Yes already those control are disabled in design time usercontrol . Now want to access enabled property in form1 page
[no name] 28-Apr-14 16:20pm    
Okay so what is stopping you? You have to make the controls public or supply a property in your usercontrol that your form1 can access.
Ramkrishn Mishra 29-Apr-14 2:27am    
Yes, those enabled= false property of TextBox inside in UserControl. After That UserControl used in form and here code behind of form, how to access TextBox.Enabled=True.

I hope try to understand
Maciej Los 28-Apr-14 16:23pm    
Please, provide more details about your issue. What have you tried? Where are you stuck?

1 solution

Please, see all comments to the question.

If you want to access to the controls on UserControl from outside of this UserControl, please see: http://stackoverflow.com/questions/411316/how-to-access-properties-of-a-usercontrol-in-c-sharp[^].

WinForms:
For further information, please see: Walkthrough: Authoring a User Control with Visual Basic .NET[^]

WebForms:
Manipulating User Control Properties[^]

I'd suggest to read this: How to: Implement Property Change Notification[^]
 
Share this answer
 

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