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

ComboBoxAdv ReadOnly?

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

1 Reply

AD Administrator Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon