0

I am using a Custom TextBox control in WinForms application. I want a property such that it has multiple values just like a combo box. Now when I choose any value in designer mode then how will that value get reflected in the CustomControl. I am not getting the logic. Kindly give any suggestion or hint.

Please comment if you need more info.

4
  • What should be the behavior of the control? What's your design-time and run-time requirement? Commented Jul 27, 2016 at 14:43
  • I need a property to validate, it will have three validationrules - a,b & c (say). Now in design mode when i select b validationrule then validationprovider attached to the customcontrol should use that b validationrule in it. Commented Jul 28, 2016 at 9:01
  • If just using showing a dropdown in property grid is enough, you can define an enum containing a, b and c. Then define a public property of type of that enum. This way the property grid will show a dropdown containing enum values for the property. Commented Jul 28, 2016 at 11:03
  • If showing just a dropdown for the property is not enough and for example some different properties should be for the selected rule, take a look at this post: WinForms designer properties of different derived types. It's suitable for cases when each validation rule has its own properties. Commented Jul 28, 2016 at 11:05

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.