Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1210
UltraCombo AutoCompleteMode customize
posted

HI,

 I am Using UltraCombo in my application.

I set AutoCompleteMode as SuggestAppend. but i want the end user only to enter the matching text in the editor if he try to enter anything which is not present in the values then it is should  not allow the user to type other letters.

For example, given a list which contains an item whose text is "Apple", when the end user types the string "Ap", the edit portion would then be updated to include the remaining characters, "ple", so that the text of the first item that matches the typed string, "Apple", becomes selected. but after "Ap" if user trying to enter any  letter  other than "p" then if matching value is not there then it should not allow the user to type characters not in the dropdown list values.

 i.e.,

if Apple is contained in the ComboBox List then the program will allow the user to type APPLE sequentially, if the user tries to type anyother letter other than the list values then user  should not be allowed to type the characters in the editor Area of ComboBox.

I tried with the following code :-

string str  = "";

bool keypressed =false;  
private void ultraCombo1_KeyPress( object sender, KeyPressEventArgs e )
{
 keypressed = true;  
}


private void ultraCombo1_TextChanged( object sender, EventArgs e )
{
 if( keypressed == true )
 {
  str = ultraCombo1.Text;
  if(str != ultraCombo1.Value)
  {
   keypressed = false;
   if( str.Length == 0 )
   return;
   ultraCombo1.Text = str.Substring( 0, str.Length - 1 );    
  } 
 }
}
  
 

it is working fine when cursor position  is not changed manually .but when the user tries to move the cursor to some other position then it behaves wrongly.

 

 

Parents Reply Children