473,503 Members | 1,650 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_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs 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_Click(sender, e);

}

}

-Harry


Nov 16 '05 #1
4 9306
"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_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs 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_Click(sender, e);

}

}

-Harry


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

"Julie" <ju***@nospam.com> 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_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs 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_Click(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.com> 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_MouseUp(object sender,
System.Windows.Forms.MouseEventArgs 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_Click(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.StandardDoubleClick and the Control.DoubleClick event.
Nov 16 '05 #4

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

"Julie" <ju***@nospam.com> 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_MouseUp(object sender,
> System.Windows.Forms.MouseEventArgs 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_Click(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.StandardDoubleClick and the Control.DoubleClick

event.

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

this.richTextOut.Click += new System.EventHandler(this.richTextOut_Click);
this.richTextOut.Click += new
System.EventHandler(this.richTextOut_DoubleClick
this.SetStyle(ControlStyles.StandardClick |
ControlStyles.StandardDoubleClick,
private void richTextOut_Click(object sender, System.EventArgs e)
{
...
}

private void richTextOut_DoubleClick(object sender, System.EventArgs e)
{
....
}

-Harry
Nov 16 '05 #5

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

Similar topics

0
3445
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...
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) //...
5
4713
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...
2
4376
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...
9
2011
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...
0
7201
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
7328
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...
1
6988
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
7456
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...
0
4672
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...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1510
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 ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
379
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...

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.