• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 544
  • Last Modified:

VB6 to vb.net code - mappoint 2006

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
VBdotnet2005
Asked:
VBdotnet2005
1 Solution
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now