We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

ComboBoxAdv ReadOnly?

Thread ID:





12596 Apr 4,2004 01:58 AM UTC Apr 5,2004 01:07 PM UTC WinForms 1
Tags: Tools
Administrator [Syncfusion]
Asked On April 4, 2004 01:58 AM UTC

Hi, I''m trying to use a combobox but no allow users to type in their own values... however when I turn on the readonly property it just disables the entire combobox... is there a different way to do this? Thanks Andy Johnson

Administrator [Syncfusion]
Replied On April 5, 2004 01:07 PM UTC

Hi Andy, The ComboBoxAdv''s ReadOnly property works precisely like any of the .NET controls'' ReadOnly property where it does not let you modify the existing value nor select a new value. However, for the above mentioned behavior in the ComboBoxAdv you would have to derive from our control and override the OnKeyPress, ProcessCmdKey and ProcessDialogKey methods as shown below : protected override void OnKeyPress(KeyPressEventArgs e) { if (this.DroppedDown == false) { this.ReadOnly = true; base.OnKeyPress(e); this.ReadOnly = false; } else base.OnKeyPress(e); } protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { if (this.DroppedDown == false) { this.ReadOnly = true; bool cachedValue = base.ProcessCmdKey(ref msg, keyData); this.ReadOnly = false; return cachedValue; } else return base.ProcessCmdKey(ref msg, keyData); } protected override bool ProcessDialogKey(Keys keyData) { if (this.DroppedDown == false) { this.ReadOnly = true; bool cachedValue = base.ProcessDialogKey(keyData); this.ReadOnly = false; return cachedValue; } else return base.ProcessDialogKey(keyData); } I have also attached a complete sample_application illustrating the above. Please refer to it and let me know if this meets your requirements. Regards, Guru Patwal Syncfusion, Inc.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon