|
-
Mar 18th, 2006, 10:25 AM
#1
Thread Starter
Junior Member
vb.net double click on button
how to make double click on button mean you just click once time only
-
Mar 18th, 2006, 10:27 AM
#2
Re: vb.net double click on button
i suppose you could disable the button for a few milliseconds after the first click, on a timer or something.. ?? Once the interval is up, enable it again...
-
Mar 18th, 2006, 10:38 AM
#3
Thread Starter
Junior Member
Re: vb.net double click on button
i want that just click once equal to double click...because i got special case...i dont want
click twice button to execute something
-
Mar 18th, 2006, 11:11 AM
#4
Registered User
Re: vb.net double click on button
the Button control Click event is raised after a single click, so i'm not sure what you are after. Could you please be more specific?
-
Mar 18th, 2006, 03:17 PM
#5
Hyperactive Member
Re: vb.net double click on button
Why not do something like this:
VB Code:
dim Ch as Boolean
// click event
if ch <> true then
// code for one click
Ch= true
else
// code for two clicks
Ch = false
end if
is that the sort of thing your looking for?
-
Mar 18th, 2006, 03:41 PM
#6
Re: vb.net double click on button
 Originally Posted by BradleyOng83
i want that just click once equal to double click...because i got special case...i dont want
click twice button to execute something
Hi,
You could also try this;
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
' here your code what your button has to do
' include next line
Button1.Enable = False
End Sub
You can make your Button1 Enable again in another Click Event.
Hope it's that what you want.
sparrow1
Last edited by sparrow1; Mar 18th, 2006 at 05:05 PM.
-
Mar 18th, 2006, 05:34 PM
#7
Re: vb.net double click on button
try this for fun:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static lastclick As Double = 0
Dim ThisClick As Double = DateAndTime.Timer
If ThisClick > lastclick + 0.5 Then
'do your single click stuff here
Debug.Print("Click")
Else
'do you doubleclick stuff here
Debug.Print("Double Click")
End If
lastclick = DateAndTime.Timer
End Sub
-
Mar 18th, 2006, 05:41 PM
#8
Re: vb.net double click on button
 Originally Posted by moeur
try this for fun:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static lastclick As Double = 0
Dim ThisClick As Double = DateAndTime.Timer
If ThisClick > lastclick + 0.5 Then
'do your single click stuff here
Debug.Print("Click")
Else
'do you doubleclick stuff here
Debug.Print("Double Click")
End If
lastclick = DateAndTime.Timer
End Sub
Hi,
I've got an error on the Debug.print line.
'Print' is not a member of 'System.Diagnostics.Debug'.
sparrow1
-
Mar 18th, 2006, 05:49 PM
#9
Re: vb.net double click on button
Hi,
I've solved the Error myself.
Here is the result.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static lastclick As Double = 0
Dim ThisClick As Double = DateAndTime.Timer
If ThisClick > lastclick + 0.5 Then
TextBox1.Text = "First Click"
Else
TextBox1.Text = "Second Click"
End If
lastclick = DateAndTime.Timer
End Sub
Anyway thanks for this code, learned more.
sparrow1
-
Mar 18th, 2006, 05:50 PM
#10
Re: vb.net double click on button
Hi,
I've solved the Error myself.
Here is the result.
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Static lastclick As Double = 0
Dim ThisClick As Double = DateAndTime.Timer
If ThisClick > lastclick + 0.5 Then
TextBox1.Text = "First Click"
Else
TextBox1.Text = "Second Click"
End If
lastclick = DateAndTime.Timer
End Sub
Anyway thanks for this code, learned more.
sparrow1
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|