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.
Unfortunately, activation email could not send to your email. Please try again.

ComboBoxAdv ReadOnly?

Thread ID:

Created:

Updated:

Platform:

Replies:

12596 Apr 3,2004 08:58 PM Apr 5,2004 09:07 AM Windows Forms 1
loading
Tags: Tools
Administrator [Syncfusion]
Asked On April 3, 2004 08:58 PM

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 09:07 AM

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.

CONFIRMATION

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.

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.

;