Solved

VB6 to vb.net code - mappoint 2006

Posted on 2007-03-24
1
509 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
ID: 18786430
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

785 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