Solved

VB6 to vb.net code - mappoint 2006

Posted on 2007-03-24
1
522 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

762 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