473,657 Members | 2,430 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How can you detect a mouse double click on a text box?

How can you detect a mouse double click on a text box? I tried the following
but it does not work.

private void richTextOut_Mou seUp(object sender,
System.Windows. Forms.MouseEven tArgs e)

// Process Mouse up in output TextBox

{

if (e.Clicks == 1) // if a single click (always == 1 ??)

{

SelectCom();

}

if (e.Clicks == 2) // if a double click (never == 2 ??)

{

SelectCom();

buttonDoIt_Clic k(sender, e);

}

}

-Harry


Nov 16 '05 #1
4 9333
"Harry J. Smith" wrote:

How can you detect a mouse double click on a text box? I tried the following
but it does not work.

private void richTextOut_Mou seUp(object sender,
System.Windows. Forms.MouseEven tArgs e)

// Process Mouse up in output TextBox

{

if (e.Clicks == 1) // if a single click (always == 1 ??)

{

SelectCom();

}

if (e.Clicks == 2) // if a double click (never == 2 ??)

{

SelectCom();

buttonDoIt_Clic k(sender, e);

}

}

-Harry


You need to set the window style to accept double click events.
Nov 16 '05 #2

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
"Harry J. Smith" wrote:

How can you detect a mouse double click on a text box? I tried the following but it does not work.

private void richTextOut_Mou seUp(object sender,
System.Windows. Forms.MouseEven tArgs e)

// Process Mouse up in output TextBox

{

if (e.Clicks == 1) // if a single click (always == 1 ??)

{

SelectCom();

}

if (e.Clicks == 2) // if a double click (never == 2 ??)

{

SelectCom();

buttonDoIt_Clic k(sender, e);

}

}

-Harry


You need to set the window style to accept double click events.


I couldn't figure out how to do that.

-Harry
Nov 16 '05 #3
"Harry J. Smith" wrote:

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
"Harry J. Smith" wrote:

How can you detect a mouse double click on a text box? I tried the following but it does not work.

private void richTextOut_Mou seUp(object sender,
System.Windows. Forms.MouseEven tArgs e)

// Process Mouse up in output TextBox

{

if (e.Clicks == 1) // if a single click (always == 1 ??)

{

SelectCom();

}

if (e.Clicks == 2) // if a double click (never == 2 ??)

{

SelectCom();

buttonDoIt_Clic k(sender, e);

}

}

-Harry


You need to set the window style to accept double click events.


I couldn't figure out how to do that.

-Harry


Look into ControlStyles.S tandardDoubleCl ick and the Control.DoubleC lick event.
Nov 16 '05 #4

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
"Harry J. Smith" wrote:

"Julie" <ju***@nospam.c om> wrote in message
news:40******** *******@nospam. com...
"Harry J. Smith" wrote:
>
> How can you detect a mouse double click on a text box? I tried the

following
> but it does not work.
>
> private void richTextOut_Mou seUp(object sender,
> System.Windows. Forms.MouseEven tArgs e)
>
> // Process Mouse up in output TextBox
>
> {
>
> if (e.Clicks == 1) // if a single click (always == 1 ??)
>
> {
>
> SelectCom();
>
> }
>
> if (e.Clicks == 2) // if a double click (never == 2 ??)
>
> {
>
> SelectCom();
>
> buttonDoIt_Clic k(sender, e);
>
> }
>
> }
>
> -Harry

You need to set the window style to accept double click events.


I couldn't figure out how to do that.

-Harry


Look into ControlStyles.S tandardDoubleCl ick and the Control.DoubleC lick

event.

This is the code I have entered. It compiles but the _Click and _DoubleClick
code is never entered:

this.richTextOu t.Click += new System.EventHan dler(this.richT extOut_Click);
this.richTextOu t.Click += new
System.EventHan dler(this.richT extOut_DoubleCl ick
this.SetStyle(C ontrolStyles.St andardClick |
ControlStyles.S tandardDoubleCl ick,
private void richTextOut_Cli ck(object sender, System.EventArg s e)
{
...
}

private void richTextOut_Dou bleClick(object sender, System.EventArg s e)
{
....
}

-Harry
Nov 16 '05 #5

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

Similar topics

0
3453
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in a flexgrid. Briefly, the technique is to overlay the cell to be edited with "floating" textbox; data is edited in the floating textbox and moved to the cell when the floating textbox loses focus. The technique works well except for when the...
4
937
by: Harry J. Smith | last post by:
How can you detect a mouse double click on a text box? I tried the following but it does not work. private void richTextOut_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e) // Process Mouse up in output TextBox {
5
4734
by: Nick | last post by:
Hey guys, I have 2 events on a windows forms datagrid, the mouse move as well as the double click events. What's happening is that when I double click on a row in the grid, the mouse move event gets triggered and the double click is not identified at all. Is there any way I can invoke the double click when the mouse move also exists?
2
4397
by: scott_gui | last post by:
I am creating a Windows application: The mouse event <Double-Button-1> has a conflict when the <Button-1> event also has a binding. Double clicks will first perform the single click action. This seems a little silly. Anyone know how to circumvent this? Right now I am having the function that is bound to the double click event undo the action the single click event performs. This is annoying and it flashes the single click event for a...
9
2022
by: erickwan88 | last post by:
I am doing a final year project for my school and is going to provide for an organization, so I am asking for some help on here. Indeed, I have no idea on how to get the input from my pen driver and use on vb2005 as when I activate the pen driver, it will run its own program itself and when I deactivate it, it become a mouse. Therefore, I need to find out how to use the pen to write words on the vb2005 program instead of being either a...
0
8392
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
8305
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
8823
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
8726
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...
0
8603
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
6163
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
5632
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();...
1
2726
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
1604
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.