473,322 Members | 1,307 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,322 software developers and data experts.

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 9277
"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
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
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
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
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
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
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.