Function Description: assigns a value to ComboBox during initialization and then queries the database by entering the value. The function is similar to the Google search function.
If it is directly bound, dynamic data changes will report "Memory Corruption" information, so there is no binding here
Problems: 1. When a keyword is entered, the input order is in reverse order.
2. The mouse pointer is concealed by the form
3. After Entering the keyword, You need to click the content twice when the drop-down box automatically pops up.
4. After the drop-down list is displayed, you cannot use the keyboard up or down key to select
Code:
Private void combobox1_textchanged (Object sender, eventargs e) <br/>{< br/> try <br/>{< br/> This. combobox1.textchanged-= new system. eventhandler (this. combobox1_textchanged); <br/> combobox1.items. clear (); <br/> string text = This. combobox1.text; <br/> dataset = geturiresultinfo (text); </P> <p> // If (this. combobox1.text! = "" & This. combobox1.text! = "") <Br/> // {<br/> // combobox1.datasource = NULL; <br/>///} <br/> // combobox1.datasource = dataset. tables [0]; <br/> // combobox1.displaymember = "content"; <br/> // combobox1.valuemember = "seqno"; <br/> // combobox1.selectedindex =-1; </P> <p> for (INT I = 0; I <dataset. tables [0]. rows. count; I ++) <br/>{< br/> This. combobox1.items. add (Dataset. tables [0]. rows [I] ["content"]); <br/>}</P> <p> combobox1.droppeddown = true; </P> <p> combobox1.text = text; <br/> combobox1.selectionstart = combobox1.text. length; <br/> // display the mouse pointer <br/> system. windows. forms. cursor. current = system. windows. forms. cursors. ibeam; <br/> // keep the mouse pointer shape <br/> cursor = system. windows. forms. cursors. default; </P> <p> // cursor. show (); <br/> // cursor. position = new point (200,200); <br/> // cursor. position = new point (cursor. position. x, cursor. position. y); </P> <p> This. combobox1.textchanged + = new system. eventhandler (this. combobox#textchanged); <br/>}< br/> catch (exception ex) <br/>{< br/> console. writeline (ex. message); <br/> // applogger. logerrexception ("frmprint. CS // frmprint: loadurirpt ", ex); <br/>}< br/> finally {}< br/>}
Problems 1, 2, 3, and 4 are resolved.