Click here to Skip to main content
15,909,242 members
Home / Discussions / C#
   

C#

 
GeneralRe: Password Textbox for Datagrid Pin
Heath Stewart23-Sep-04 11:37
protectorHeath Stewart23-Sep-04 11:37 
General.NET load of DLL in privatePath failing -- HELP!!!! Pin
LongRange.Shooter23-Sep-04 8:19
LongRange.Shooter23-Sep-04 8:19 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
Heath Stewart23-Sep-04 10:41
protectorHeath Stewart23-Sep-04 10:41 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
LongRange.Shooter23-Sep-04 11:07
LongRange.Shooter23-Sep-04 11:07 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
Heath Stewart23-Sep-04 11:21
protectorHeath Stewart23-Sep-04 11:21 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
LongRange.Shooter24-Sep-04 4:40
LongRange.Shooter24-Sep-04 4:40 
GeneralRe: .NET load of DLL in privatePath failing -- HELP!!!! Pin
Heath Stewart24-Sep-04 5:36
protectorHeath Stewart24-Sep-04 5:36 
GeneralRe: Basic EventHandling Question Pin
Heath Stewart23-Sep-04 7:21
protectorHeath Stewart23-Sep-04 7:21 
The most common solution is to use a Timer. Since you're using Windows forms, just drop the Timer component on your form and double-click to add an event handler for the Timer.Tick event.

The following sample shows how you should change your current code, as well as what code you should add:
public MyClass() // Your constructor
{
  InitializeComponent(); // Put there by the designer.
  timer1.Interval = SystemInformation + SystemInformation.DoubleClickTime + 10;
}
private void ClickHandler()
{
  // Put whatever was in your Click event handler here.
}
private listView1_Click(object sender, EventArgs e)
{
  timer1.Enabled = true;
}
 
private listView1_DoubleClick(object sender, EventArgs e)
{
  timer1.Enabled = false;
  // Your double-click event handler code goes here.
}
 
private timer1_Tick(object sender, EventHandler e)
{
  timer1.Enabled = false;
  ClickHandler(); // Call your actual click handler.
}
It's a simplified example, but it shows the basics of using a timer to distinguish between clicks and double clicks. There are other ways, but using timers is quite simple.

Also note that the .NET BCL (base class library) provides three different Timer classes. You might want to evaluate which one works best for you.

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles]
GeneralRe: Basic EventHandling Question Pin
SandeepN23-Sep-04 8:49
SandeepN23-Sep-04 8:49 
GeneralRe: Basic EventHandling Question Pin
Heath Stewart23-Sep-04 10:53
protectorHeath Stewart23-Sep-04 10:53 
GeneralRe: Basic EventHandling Question Pin
SandeepN24-Sep-04 4:32
SandeepN24-Sep-04 4:32 
GeneralHowto: Lock my ArrayList collection. Pin
matthias s.23-Sep-04 6:47
matthias s.23-Sep-04 6:47 
GeneralRe: Howto: Lock my ArrayList collection. Pin
Heath Stewart23-Sep-04 7:34
protectorHeath Stewart23-Sep-04 7:34 
GeneralRe: Howto: Lock my ArrayList collection. Pin
Werdna23-Sep-04 10:29
Werdna23-Sep-04 10:29 
GeneralBasic EventHandling Question Pin
SandeepN23-Sep-04 6:42
SandeepN23-Sep-04 6:42 
GeneralInterfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 4:53
Evelyne23-Sep-04 4:53 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 6:58
protectorHeath Stewart23-Sep-04 6:58 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne23-Sep-04 8:47
Evelyne23-Sep-04 8:47 
GeneralRe: Interfacing with C Vendor DLLs Pin
Heath Stewart23-Sep-04 10:17
protectorHeath Stewart23-Sep-04 10:17 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne24-Sep-04 16:15
Evelyne24-Sep-04 16:15 
GeneralRe: Interfacing with C Vendor DLLs Pin
Evelyne28-Sep-04 10:32
Evelyne28-Sep-04 10:32 
QuestionC# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 4:44
cemlouis23-Sep-04 4:44 
AnswerRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 10:32
Werdna23-Sep-04 10:32 
GeneralRe: C# SQL data check like in PHP??? Pin
cemlouis23-Sep-04 11:12
cemlouis23-Sep-04 11:12 
GeneralRe: C# SQL data check like in PHP??? Pin
Werdna23-Sep-04 11:38
Werdna23-Sep-04 11:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.