Programatically Pressing buttons on mouse events

Its easy for left mouse click...right mouse click is frustrating me

Page 1 of 1

1 Replies - 2196 Views - Last Post: 22 December 2008 - 11:20 AM Rate Topic: -----

#1 tgebrael  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 11
  • Joined: 22-December 08

Programatically Pressing buttons on mouse events

Posted 22 December 2008 - 08:47 AM

Hi Guys...This is probably so simple that I'm missing it...heres basically what I am trying to do...A simple form with 2 buttons YES and NO

Right now I have it so that when you click the form it programatically performs a click on the YES button.

I am finding it very difficult to do the same when you press the right mouse button over the form it should programatically perform a click on the NO button.

Am I mental...shouldnt mouse_rightclick be a damn event all the rest are there.


	Private Sub Form1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseClick
		btnRight.PerformClick()
	End Sub




Is This A Good Question/Topic? 0
  • +

Replies To: Programatically Pressing buttons on mouse events

#2 n8wxs  Icon User is offline

  • --... ...-- -.. . -. ---.. .-- -..- ...
  • member icon

Reputation: 972
  • View blog
  • Posts: 3,878
  • Joined: 07-January 08

Re: Programatically Pressing buttons on mouse events

Posted 22 December 2008 - 11:20 AM

	Private Sub Form1_MouseClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseClick
		If e.Button = Windows.Forms.MouseButtons.Left Then
			Button2.PerformClick()
		End If
		If e.Button = Windows.Forms.MouseButtons.Right Then
			Button3.PerformClick()
		End If
	End Sub


See

MouseEventArgs.Button Property

This post has been edited by n8wxs: 22 December 2008 - 03:17 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1