473,385 Members | 1,343 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,385 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 9294
"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: 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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

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.