mousehover?
-
im very new to vs.net windows apps. i know the console apps quite a bit now. i am also coming from vb6. i was just wondering how to perform code when events such as mousehover occurs? or any of these basic events. any help appreciated, thanks. ------------------------ Jordan. III
-
im very new to vs.net windows apps. i know the console apps quite a bit now. i am also coming from vb6. i was just wondering how to perform code when events such as mousehover occurs? or any of these basic events. any help appreciated, thanks. ------------------------ Jordan. III
If you are using the VS.NET IDE then in the code view there are two dropdowns. Set the first dropdown to the object you want to set the event for and set the second dropdown to the event you want to hook into. It will generate the Subs for you, you just fill in the details. -OR- If you are not using the IDE then you can use addHandler to hook into the events. ex. addhandler Panel1.Click, addressof clickResponse (addrssof sets clickResponse as the callback sub) the advantage to doing this is you can do somthing like addhandler Panel1.Click, addressof clickResponse addhandler Panel2.Click, addressof clickResponse addhandler Panel3.Click, addressof clickResponse and in clickResponse just do a sender.name to get the object that called the sub -or (the easiest way) - You can declare it like this: Private Sub Panel1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click The handles on the end specifies whats tied to this sub you can also specify multiple events this way like so: Private Sub Panel1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click, Panel2.Click, Panel3.Click as you can see the name of the sub is not important using this method it could be anything you want like.. Private Sub eatAtJoes(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click, Panel2.Click, Panel3.Click
-
If you are using the VS.NET IDE then in the code view there are two dropdowns. Set the first dropdown to the object you want to set the event for and set the second dropdown to the event you want to hook into. It will generate the Subs for you, you just fill in the details. -OR- If you are not using the IDE then you can use addHandler to hook into the events. ex. addhandler Panel1.Click, addressof clickResponse (addrssof sets clickResponse as the callback sub) the advantage to doing this is you can do somthing like addhandler Panel1.Click, addressof clickResponse addhandler Panel2.Click, addressof clickResponse addhandler Panel3.Click, addressof clickResponse and in clickResponse just do a sender.name to get the object that called the sub -or (the easiest way) - You can declare it like this: Private Sub Panel1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click The handles on the end specifies whats tied to this sub you can also specify multiple events this way like so: Private Sub Panel1_Click(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click, Panel2.Click, Panel3.Click as you can see the name of the sub is not important using this method it could be anything you want like.. Private Sub eatAtJoes(ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Panel1.Click, Panel2.Click, Panel3.Click
first of all, thank you. and i do like that last easy method.. only one problem, i was just messing around with the events for a button. im using system.eventargs to handle the click event, and forms.mouseeventargs to handle mousemove. is there a page to go to that gives a list of all the references you must use in order to do each event? like, say i want to do an event for a button which controls the mousedown method. is there a way of determining what you need to set 'e' as? ------------------------ Jordan. III
-
first of all, thank you. and i do like that last easy method.. only one problem, i was just messing around with the events for a button. im using system.eventargs to handle the click event, and forms.mouseeventargs to handle mousemove. is there a page to go to that gives a list of all the references you must use in order to do each event? like, say i want to do an event for a button which controls the mousedown method. is there a way of determining what you need to set 'e' as? ------------------------ Jordan. III
You do not set "e". Anything like mouseevent args are paramiters to he sub. In otherwords thats what gets sent to the sub. in the case of MouseEventArgs you can check things like if e.button = mousebutton.left etc... Read all about it in the help or on MSDN and download apps that people write so you can see how things are done. Start here: http://samples.gotdotnet.com/quickstart/winforms/[^] Msdn: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpqstart/html/cpsmpwindowsformsquickstart.asp[^]
-
You do not set "e". Anything like mouseevent args are paramiters to he sub. In otherwords thats what gets sent to the sub. in the case of MouseEventArgs you can check things like if e.button = mousebutton.left etc... Read all about it in the help or on MSDN and download apps that people write so you can see how things are done. Start here: http://samples.gotdotnet.com/quickstart/winforms/[^] Msdn: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpqstart/html/cpsmpwindowsformsquickstart.asp[^]
about the 'e' thing, i was referring to the 'ByVal e As System.EventArgs' part. i guess i shouldntve said what do you set e to, but what type, or event, or wutever its called, do you set e to. but thank you. I will go check out the docs now, thx again for ur help. ------------------------ Jordan. III