472,353 Members | 1,663 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 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 9114
"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...
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...
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...
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...
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...
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...

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.