473,799 Members | 3,212 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Press Enter key, then Combobox clear text, how to stop it ?

4 New Member
Hi,
I use Combobox in DropDownStyle = simple, and AutoCompleteMod e, I bind DataSource for Combobox. So I have a Combobox AutoComplete with a list from Database.
When I use in DropDownStyle = DropDownList, it don't have problem.
But when I use it in Simple, when I chose a item by press Enter, Text of Combobox is cleared. I use PreviewKeyDown and set again text for Combobox. But there are 2 times occur this event, and text is set 1 times, then it is cleared.
Please help me solve this problem. Thanks.
I post 4 images. First image is I chose item.
Second image is PreviewKeyDown occur first time.
Third image is set Text of Combobox (it is cleared).
Fourth image is PreviewKeyDown occur again, then Text is cleared.
Attached Images
File Type: jpg untitled1.jpg (17.7 KB, 786 views)
File Type: jpg untitled2.jpg (18.1 KB, 585 views)
File Type: jpg untitled3.jpg (17.4 KB, 504 views)
File Type: jpg untitled4.jpg (16.6 KB, 471 views)
May 1 '12 #1
3 8591
QuangNhat
4 New Member
:), I have just find the answer, I add a command, result:
Expand|Select|Wrap|Line Numbers
  1. if (e.KeyValue == 13)
  2.             {
  3.                 if (Combobox.Text != "")
  4.                     StringGlobal = Combobox.Text;
  5.                 if (Combobox.Text == "")
  6.                     Combobox.Text = StringGlobal;
  7.             }
But I use mouse to chose the item, text is cleared.
May 1 '12 #2
RhysW
70 New Member
i would say you aren't using the autocomplete properly then if its deleting everything
May 1 '12 #3
QuangNhat
4 New Member
I want to create a input (input commands) that it have a function like intellsense. I have found on internet and I found 2 ways: use rich textbox + custom code (harder) and autocomplete combobox.
My combobox (more important properties):
AutoCompleteMod e = SuggestAppend
AutoCompleteSou rce = ListItems
DropDownStyle = Simple
DataSource = MyDataBindingSo urce
My combobox display a list of commands. When user type, it show commands follow character is typed.
If who can have a solution for my problem, I thank you.
May 1 '12 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
71935
by: JCO | last post by:
How's come when I press the enter key, I can't get it to execute the correct password. It seems that I'm forced to press the button. I want to be able to do both. How is this done?
4
2180
by: penny336 | last post by:
hi here is my original// it can convert to upper case or lower case but require user press "enter" how to implement a without "press enter" version e.g. if input 'a' --> at commad prompt will show 'A' immediately if read '(' it will end. int main() { char input; //char input1; cout<<"Please Enter As mush as you can:";
5
20989
by: junk mail | last post by:
My friend is trying to code a small c program where he wants to force the user to press enter and only enter to continue. Currently he is using getchar() with a loop but you can type any number of characters, which are echoed to screen before you have to press enter. For example:- do { /* Begin loop */
0
1274
by: Lalit Bhatia | last post by:
I have a problem while using Enter key in text box. when user presses enter in the text box information of customer is loaded. and I have a clear button that clears all the controls on the form. first it works properly. then I click on some other button (say detail button) that opens some other form. after closing that form if clear the form using clear button and again enter Id in text box and press enter. it does not work instead click...
1
7560
by: Mamatha | last post by:
Hi I have a samll application. In that i have one textbox and one button. When i enter some text in text box and press enter then the button will have a focus. How can i do this? Mamatha
11
8645
by: dhirajpriya | last post by:
hi everyone when i create single text box on page and press enter the page refresh how can i stop to refresh the page.... dhiraj
5
1451
by: hmkaddoura | last post by:
Hi All, in my form I have two textboxes (T1,T2) and two buttons (B1,B2) how can i insert text in T1 and press enter to execute B1 event, and insert text in T2 and press enter to execute B2 event. the only thing that i found is that I set in the Form itself the property of AcceptButton and choose which button (only one button) is there away for doing so? (i know it is possible but need help :) ) Regards,
1
8825
by: RyanT | last post by:
Access 2000 Windows XP I have a small form with two text boxes: - User ID - Password The form also has two command buttons: - Login - Cancel
1
7030
by: daonho | last post by:
I tried to use javascript to trigger up the button click function when user press enter key from the textbox. This function work fine with a single button click such has login page. However, if the page has multiple button such login page with a search function somewhere around, then it's not respond properly. I have attached a brief example of two text boxes and two button. When ever a key is press on textbox one, I want to trigger...
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9541
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10485
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10231
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.