473,396 Members | 1,871 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Help with KeyPress on comboBox! Code included!

Ok, I have been researching this problem for the past two hours (at least!)
and I just can't seem to figure it out. So I broke down and decided to post
some code for some of you gurus to look at.

When running the code, don't forget to add the autoCompleteComboBox.dll file
which is included.

I hope it's not inappropiate to post code here. Please let me know if it
is.

On the surface the code really isn't that complicated. It works like
this...

1) The user presses F3
2) The KeyUp event is lauched (on the form) and the comboBoxes are cleared
(not the actual items, but the top part - where the user types).

But it doesn't seem to work. Help!

You can download my code file here...
http://www.mnik.com/temp/app1.zip
Nov 16 '05 #1
2 5094
Hi!
The problem is that the keypreview doesn't work with comboboxes.
So, you must use the event KeyUp from every combobox.
Hope that helps.
Best regards.
Nov 16 '05 #2
There's something wrong with the AutoCompleteComboBox, in order to get the
code to work properly I had to set the text = "" twice...

private void Form1_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode==Keys.F3)
{
e.Handled = ClearComboBox ( autoCompleteComboBox1 )
|| ClearComboBox ( autoCompleteComboBox2 );
}
}

private bool ClearComboBox( AutoCompleteComboBox.AutoCompleteComboBox
accb )
{
if ( accb.Focused )
{
accb.SelectAll();
accb.Refresh();
accb.Text = "";
accb.Text = "";
return true;
}

return false;
}
Hope that helps.

Dan.

"Keith Smith" <ke*********@verizon.net> wrote in message
news:RZoXd.43080$uc.36190@trnddc01...
Ok, I have been researching this problem for the past two hours (at
least!)
and I just can't seem to figure it out. So I broke down and decided to
post
some code for some of you gurus to look at.

When running the code, don't forget to add the autoCompleteComboBox.dll
file
which is included.

I hope it's not inappropiate to post code here. Please let me know if it
is.

On the surface the code really isn't that complicated. It works like
this...

1) The user presses F3
2) The KeyUp event is lauched (on the form) and the comboBoxes are
cleared
(not the actual items, but the top part - where the user types).

But it doesn't seem to work. Help!

You can download my code file here...
http://www.mnik.com/temp/app1.zip

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Agency | last post by:
I'm trying to program a utility that counts the beats per minute in a song by tapping the spacebar. I already have a program that does this, but I wanted to make my own. The "enter" key resets the...
6
by: rich_poppleton | last post by:
Help.... I've got a textarea where people type in a description. However for certain reasons we need to stop them typing !$*^ . I have a solution this which works fine in IE: function...
20
by: Jack Schitt | last post by:
I thought I was starting to get a handle on Access, until I tried doing something useful...now I'm stuck. I have a DB with two tables - to keep it simple I'll say that one is an Employee File...
1
by: Rene | last post by:
Hi, I am running is some problems with the KeyPreview and KeyPress events. The KeyPress event is only triggered when there this an focusable control on the form. When all controls are disabled...
4
by: Tom | last post by:
I have a ComboBox that I wrote a KeyPress event for. Basically, it looks to make sure that a numeric key has been pressed; if not, then it does a Beep() and sets e.Handled to True. This should, as...
8
by: strchild | last post by:
Hi again guys, I apologize as it's been posted before and I'm sure it's an easy problem to fix, but the message has long since left my news server now that I need it, and I can't find it...
4
by: Tom | last post by:
I have a VB.NET user control that I wrote - this control has three or four other controls on it (textbox, combobox, datetime picker, etc). Now, whenever the control is on a form and the user enters...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
1
by: korr | last post by:
Hi there, i'm trying to develop a quiz in flash. Searching on the net, I found a quiz in flashkit from sephiroth.it by Alessandro Crugnola. His quiz has a script that puts the questions and the...
2
by: Tony Johansson | last post by:
Hello! I have created a Control that consist of a label and a textbox.I have called this class ctlLabelTextbox. public partial class ctlLabelTextbox : UserControl { .... } The class that I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.