Community of MapPoint and Virtual Earth Users and Developers
This is a discussion on How to add click event for VB.Net ? within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello... We are have a vb.net app and are able to display a map with pushpins that represent the results ...
| |||||||
| Today's Posts | Twitter Feed | Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| How to add click event for VB.Net ? We are have a vb.net app and are able to display a map with pushpins that represent the results from a sql server database query. This works fine. Now....I need to be able to let the user double-click on one of the pushpins and then display a modal dialog that contains some detailed info about the pushpin location. Is this possible? I saw some articles and posts that mention the SelectedChange event....but I am having problems getting this to work. If anyone knows of a good sample or article that would be appreciated. Thank you |
| |||
|
Well, if you're looking to trap what they've selected, you can use the selection changed event like so: Code: Private Sub MapCtrl_SelectionChange(ByVal sender As Object, ByVal e As AxMapPoint._IMappointCtrlEvents_SelectionChangeEvent) Handles MapCtrl.SelectionChange
If TypeOf (e.pNewSelection) Is MapPoint.Pushpin Then
' A pushpin has been selected, get a reference to it
Dim pin As MapPoint.Pushpin = e.pNewSelection
' Call your method to display the box
Me.DisplayPinDetails(pin)
End If
End Sub
E.G. Code: Private Sub MapCtrl_DblClick(ByVal sender As Object, ByVal e As AxMapPoint._IMappointCtrlEvents_BeforeDblClickEvent) Handles MapCtrl.DoublClick
Dim searchResults As MapPoint.FindResults = Me.ActiveMap.ObjectsFromPoint(e.x, e.y)
Dim pin As MapPoint.Pushpin
For Each result As Object In searchResults
If TypeOf result Is MapPoint.Pushpin Then
pin = result
Exit For
End If
Next
' Call your method to display the box
Me.DisplayPinDetails(pin)
End Sub
BEWARE: This may cause your app to hang if your "DisplayPinDetails" method takes too long to run (I'm having problems along that line due to OleServer timeouts). Hope this helps. MR |
![]() |
| Tags |
| add, click, event, vbnet |
| ||||
| Posted By | For | Type | Date | |
| adding an onclick event in a .vb class - ng.asp-net-forum.windows-hosting_open_forum - error problem solve @CodeVerge | This thread | Refback | 01-31-2009 12:15 PM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Right-Click event on the colored countries | bgopal | MapPoint 2006/2009 Discussion | 1 | 07-14-2005 09:42 AM |
| Where did I click on that line? | Jumbly | MapPoint 2006/2009 Discussion | 3 | 12-08-2004 03:53 AM |
| Long/Lat from click. | Milo | MapPoint 2006/2009 Discussion | 7 | 10-29-2004 07:32 AM |
| Disable Click Event property in a rendered map/mapimage ? | the_jock | MapPoint 2006/2009 Discussion | 1 | 01-28-2004 05:17 AM |
| Double Click on map | Anonymous | MapPoint 2006/2009 Discussion | 0 | 08-08-2003 06:42 PM |
Majorca Holiday
Enjoy a Majorca holiday at a good price when you check out the offers on UlookUbook for this popular destination!