Private Sub txtName_MouseEnter(sender As Object, e As EventArgs) _ 'code for handling mouse leave on ID textbox Private Sub txtID_MouseLeave(sender As Object, e As EventArgs) _ 'code for handling mouse enter on ID textbox Private Sub txtID_MouseEnter(sender As Object, e As EventArgs)_ Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Take the following steps −Īdd three labels, three text boxes and a button control in the form.Ĭhange the text properties of the labels to - Customer ID, Name and Address, respectively.Ĭhange the name properties of the text boxes to txtID, txtName and txtAddress, respectively.Ĭhange the text property of the button to 'Submit'.Īdd the following code in the code editor window − Y − indicates the y-coordinate of mouse clickįollowing is an example, which shows how to handle mouse events. X − indicates the x-coordinate of mouse click It has the following properties −īuttons − indicates the mouse button pressedĭelta − indicates the number of detents the mouse wheel rotated The MouseEventArgs object is used for handling mouse events. The event handlers of the mouse events get an argument of type MouseEventArgs. MouseWheel − it occurs when the mouse wheel moves and the control has focus MouseUp − it occurs when the mouse pointer is over the control and the mouse button is released MouseMove − it occurs when the mouse pointer moves over the control MouseLeave − it occurs when the mouse pointer leaves the control MouseHover − it occurs when the mouse pointer hovers over the control MouseEnter − it occurs when the mouse pointer enters the control MouseDown − it occurs when a mouse button is pressed Following are the various mouse events related with a Control class − Mouse events occur with mouse movements in forms and controls. Event handlers are functions that tell how to respond to an event. An event is an action that calls a function or may cause another event. Applications need to respond to events when they occur.Ĭlicking on a button, or entering some text in a text box, or clicking on a menu item, all are examples of events. Events are basically a user action like key press, clicks, mouse movements, etc., or some occurrence like system generated notifications.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |