Solved

VB6 to vb.net code - mappoint 2006

Posted on 2007-03-24
1
487 Views
Last Modified: 2008-01-09
I need help coverting below code from vb6 to vb.net

[Microsoft Visual Basic 6.0]
  Sub FindAddressSearch()
  Dim objApp As New MapPoint.Application
  Dim objFindResults As MapPoint.FindResults
  'Set up application
  objApp.Visible = True
  objApp.UserControl = True
  'Output first result of find search
  Set objFindResults = objApp.ActiveMap.FindAddressResults("One Microsoft Way", "Redmond", , "WA", , geoCountryUnitedStates)
  MsgBox "The first item in the find list is: " _
    + objFindResults.Item(1).Name
  End Sub





  Sub ReturnPostalCode()

  Dim objApp As New MapPoint.Application
  Dim objMap As MapPoint.Map
  Dim strAddress As String
  Dim objSA As MapPoint.StreetAddress
     
  'Set up the application
  Set objMap = objApp.ActiveMap
  objApp.Visible = True
  objApp.UserControl = True

  'Set a string, then parse it
  strAddress = "1 Microsoft Way, Redmond, WA 98052"
  Set objSA = objMap.ParseStreetAddress(strAddress)

  'Return the postal code of the parsed address
  MsgBox "Postal code: " + CStr(objSA.PostalCode)

  End Sub
0
Comment
Question by:VBdotnet2005
1 Comment
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
I don't see anything that really needs "converting"...other than minor syntax changes.

(1) You can get rid of the "set" keyword.
(2) Not really a conversion, but you really should be using & instead of + for String concatenation.
(3) You need parenthesis around the parameters in MsgBox...better yet, use the new MessageBox class:

    MessageBox.Show("Postal code: " & CStr(objSA.PostalCode))

instead of:

    MsgBox("Postal code: " & CStr(objSA.PostalCode))
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Suggested Solutions

Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now