473,785 Members | 2,154 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"ListBox DoubleClick" doesn't handle "select, then press Enter"

I can handle DoubleClick on a ListBox to respond, not when the
selection changes, but when you double click one to invoke an action.
This is the same as using the keys to move the selection, then
pressing Enter. But, of course, DoubleClick doesn't automatically
handle that.

Is there any way to handle ALL standard UI at once, rather than
checking for DoubleClick and for Enter press manually?

Zytan

Apr 4 '07 #1
3 5707
"Zytan" <zy**********@g mail.comwrote:
Is there any way to handle ALL standard UI at once,
rather than checking for DoubleClick and for Enter press
manually?
No, but you can avoid the duplication by calling one event handler
from the other, as in:

private void myList_KeyPress (object sender, KeyPressEventAr gs e)
{
if (e.KeyChar == Keys.Return)
{
myList_DoubleCl ick(sender, EventArgs.Empty );
}
}

If you want every ListBox to behave this way, consider inheriting from
ListBox, adding what you want, and using your derived control instead
of the standard one.

Eq.
Apr 4 '07 #2
No, but you can avoid the duplication by calling one event handler
from the other, as in:

private void myList_KeyPress (object sender, KeyPressEventAr gs e)
{
if (e.KeyChar == Keys.Return)
{
myList_DoubleCl ick(sender, EventArgs.Empty );
}
}

If you want every ListBox to behave this way, consider inheriting from
ListBox, adding what you want, and using your derived control instead
of the standard one.
Thanks, Paul. I think (I said I think) with Win32, you can just
handle a single message, and it's the same message for them both, so
Win32 is actually easier than the .NET wrappers in this case, weird.

Zytan

Apr 5 '07 #3
Small type cast fix:
private void myList_KeyPress (object sender, KeyPressEventAr gs e)
{
if (e.KeyChar == (char)Keys.Retu rn)
myList_DoubleCl ick(sender, EventArgs.Empty );
}
Zytan

Apr 5 '07 #4

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

Similar topics

1
1471
by: VK | last post by:
Hello: I have a control listed as: <asp:ListBox id="ddlList" runat="server" SelectionMode="Multiple"></asp:ListBox> - this list is dynamic. We would like users to select 4 choices. Is there a way to write this within this control or do we have to write javascript to control the number of choices made? Or any other ideas are welcome!
99
6243
by: Jim Hubbard | last post by:
It seems that Microsoft not only does not need the classic Visual Basic developer army (the largest army of developers the world has ever seen), but now they don't need ANY Windows developer at a small or mid-sized business. http://groups-beta.google.com/group/microsoft.public.msdn.general/browse_thread/thread/9d7e8f9a00c1c7da/459ca99eb0e7c328?q=%22Proposed+MSDN+subscription+changes%22&rnum=1#459ca99eb0e7c328 Damn! To be that...
2
3043
by: Danny | last post by:
Hello I am trying to create a separate listbox and fill it with items based on what is in another field in a database. This field is bound to a field in the underlying database. But the data is changed from another list box that is a pulldown of the 3 items. This way they are forced to select one of the 3 items. So when the field updates based on the item chosen, why doesnt it cause the "on change event" to happen? The field has...
3
2429
by: beta | last post by:
Hello everyone, I need some help here. If anyone has encountered this, knidly give me your advice. I have a command button (Command0) and a listbox (List1). Upon clicking the command button, I want my listbox to be populated. Please look at the code below. The fields Day2 and Filename are both text fields. My problem is that Day2 field has rows with the text value "N/A" (without the quotes). MS Access is evaluating the "/" sign in
2
3040
by: google | last post by:
Hello everyone, I am having an issue using the "Multi Select" option in a list box in MS Access 2003. I am making a form that users can fill out to add an issue to the database. Each issue can be associated with multiple categories. I have an "Issue," "IssueCategory," and "Category" in the database (among other tables). The form has a subform in it which is tied to the "IssueCategory" table. The main form is tied to the "Issue"...
19
2629
by: VB Programmer | last post by:
If I have a VB6 and a VB.NET application, or 2 VB.NET applications what is the best way to "talk" between them? They both run on the same PC. Right now I'm just using text files to share information, etc... (Not database applications.) Thanks.
1
1430
by: Dib | last post by:
Hi, how do I call a form to open from another form. example I have a frmLogIn and an frmError The frmError have a ListBox. If the frmLogin generated an error I want the error to show in the ListBox on frmError.
11
14274
by: kimiraikkonen | last post by:
Hi, Vb.net 2005 express i've been working, the problem is: I use openfiledialog to browse files, i created some code to execute file with OK button, no problem. But if i press "cancel" button as the result of openfiledialog box, for example my filename's are added into listbox or my audio file is being played from the beginning. To explain better: openfileplaylist.ShowDialog()
4
1457
by: kimiraikkonen | last post by:
Hi, I have a odd but a known question about listbox. I know listbox control can provide multi-select, multi-extendend selections. But i wonder if this selection type belongs to them or it has another tecnique. As you may know, in softwares like Windows Media Player or Winamp playlist has a listbox and it can be selected in 2 types. First type refers to player's own selection and second selection type can be done by user to look for...
0
9646
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
9484
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
10350
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...
1
10097
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
8983
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7505
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
5518
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.