MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




How to add click event for VB.Net ?

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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 12-29-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
How to add click event for VB.Net ?

Hello...

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 12-30-2003
Junior Member
White Belt
 
Join Date: Nov 2003
Posts: 5
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
Of course, this will happen on a single-click instead of a double-click. Your other option would probably be to trap the BeforeDoubleClick event, determine the appropriate pushpin, and then run the same detail method.

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
Of course, the above code assumes you've only got one pushpin at the selection point. If you want to plan for many pushpins, you'll have to present the user with a list of those to make a selection.

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 12-31-2003
Senior Member
Black Belt
 
Join Date: Jul 2002
Posts: 5,138
Thank you very much. I was having many problems trying to figure out how to refer to the object and determine a pushpin selection.

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
add, click, event, vbnet


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Right-Click event on the colored countries bgopal MapPoint 2006/2009 Discussion 1 07-14-2005 10:42 AM
Where did I click on that line? Jumbly MapPoint 2006/2009 Discussion 3 12-08-2004 04:53 AM
Long/Lat from click. Milo MapPoint 2006/2009 Discussion 7 10-29-2004 08:32 AM
Disable Click Event property in a rendered map/mapimage ? the_jock MapPoint 2006/2009 Discussion 1 01-28-2004 06:17 AM
Double Click on map Anonymous MapPoint 2006/2009 Discussion 0 08-08-2003 07:42 PM


All times are GMT -5. The time now is 07:54 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54