Click here to Skip to main content
15,894,405 members
Articles / Mobile Apps / Windows Mobile

Location Aware Phone Book

Rate me:
Please Sign up or sign in to vote.
4.80/5 (6 votes)
18 Aug 2007CPOL6 min read 50.9K   875   30  
An article on using the Microsoft Live Search API to make a location aware phone book
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Public Class LocationForm
    Inherits System.Windows.Forms.Form

    'Form overrides dispose to clean up the component list.
    <System.Diagnostics.DebuggerNonUserCode()> _
    Protected Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing AndAlso components IsNot Nothing Then
            components.Dispose()
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer
    Private mainMenu1 As System.Windows.Forms.MainMenu

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    <System.Diagnostics.DebuggerStepThrough()> _
    Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim ListViewItem1 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem
        Dim ListViewItem2 As System.Windows.Forms.ListViewItem = New System.Windows.Forms.ListViewItem
        Me.mainMenu1 = New System.Windows.Forms.MainMenu
        Me.miOK = New System.Windows.Forms.MenuItem
        Me.miCancel = New System.Windows.Forms.MenuItem
        Me.lblDefaultLocation = New System.Windows.Forms.Label
        Me.chkEnableLocation = New System.Windows.Forms.CheckBox
        Me.ddlGpsPort = New System.Windows.Forms.ComboBox
        Me.Label1 = New System.Windows.Forms.Label
        Me.gpsPort = New System.IO.Ports.SerialPort(Me.components)
        Me.lvLocationList = New System.Windows.Forms.ListView
        Me.ColumnHeader1 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader2 = New System.Windows.Forms.ColumnHeader
        Me.ColumnHeader3 = New System.Windows.Forms.ColumnHeader
        Me.cmdAutoDetectGpsPort = New System.Windows.Forms.Button
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.Panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'mainMenu1
        '
        Me.mainMenu1.MenuItems.Add(Me.miOK)
        Me.mainMenu1.MenuItems.Add(Me.miCancel)
        '
        'miOK
        '
        Me.miOK.Text = "&OK"
        '
        'miCancel
        '
        Me.miCancel.Text = "&Cancel"
        '
        'lblDefaultLocation
        '
        Me.lblDefaultLocation.Location = New System.Drawing.Point(3, 0)
        Me.lblDefaultLocation.Name = "lblDefaultLocation"
        Me.lblDefaultLocation.Size = New System.Drawing.Size(100, 20)
        Me.lblDefaultLocation.Text = "Default Location"
        '
        'chkEnableLocation
        '
        Me.chkEnableLocation.Location = New System.Drawing.Point(116, 3)
        Me.chkEnableLocation.Name = "chkEnableLocation"
        Me.chkEnableLocation.Size = New System.Drawing.Size(109, 20)
        Me.chkEnableLocation.TabIndex = 2
        Me.chkEnableLocation.Text = "Enable GPS"
        '
        'ddlGpsPort
        '
        Me.ddlGpsPort.Items.Add("COM1:")
        Me.ddlGpsPort.Items.Add("COM2:")
        Me.ddlGpsPort.Items.Add("COM3:")
        Me.ddlGpsPort.Items.Add("COM4:")
        Me.ddlGpsPort.Items.Add("COM5:")
        Me.ddlGpsPort.Items.Add("COM6:")
        Me.ddlGpsPort.Items.Add("COM7:")
        Me.ddlGpsPort.Items.Add("COM8:")
        Me.ddlGpsPort.Items.Add("COM9:")
        Me.ddlGpsPort.Items.Add("COM10:")
        Me.ddlGpsPort.Items.Add("COM11:")
        Me.ddlGpsPort.Items.Add("COM12:")
        Me.ddlGpsPort.Items.Add("COM13:")
        Me.ddlGpsPort.Items.Add("COM14:")
        Me.ddlGpsPort.Items.Add("COM15:")
        Me.ddlGpsPort.Items.Add("COM16:")
        Me.ddlGpsPort.Items.Add("COM17:")
        Me.ddlGpsPort.Items.Add("COM18:")
        Me.ddlGpsPort.Items.Add("COM19:")
        Me.ddlGpsPort.Items.Add("COM20:")
        Me.ddlGpsPort.Location = New System.Drawing.Point(0, 29)
        Me.ddlGpsPort.Name = "ddlGpsPort"
        Me.ddlGpsPort.Size = New System.Drawing.Size(142, 22)
        Me.ddlGpsPort.TabIndex = 3
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(3, 3)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(83, 20)
        Me.Label1.Text = "GPS Port"
        '
        'lvLocationList
        '
        Me.lvLocationList.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
                    Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.lvLocationList.Columns.Add(Me.ColumnHeader1)
        Me.lvLocationList.Columns.Add(Me.ColumnHeader2)
        Me.lvLocationList.Columns.Add(Me.ColumnHeader3)
        Me.lvLocationList.FullRowSelect = True
        ListViewItem1.Text = "Atlanta"
        ListViewItem1.SubItems.Add("33.74523")
        ListViewItem1.SubItems.Add("-84.39025")
        ListViewItem2.Text = "Chicago"
        ListViewItem2.SubItems.Add("41.87552")
        ListViewItem2.SubItems.Add("-87.64549")
        Me.lvLocationList.Items.Add(ListViewItem1)
        Me.lvLocationList.Items.Add(ListViewItem2)
        Me.lvLocationList.Location = New System.Drawing.Point(5, 21)
        Me.lvLocationList.Name = "lvLocationList"
        Me.lvLocationList.Size = New System.Drawing.Size(228, 104)
        Me.lvLocationList.TabIndex = 5
        Me.lvLocationList.View = System.Windows.Forms.View.Details
        '
        'ColumnHeader1
        '
        Me.ColumnHeader1.Text = "City"
        Me.ColumnHeader1.Width = 71
        '
        'ColumnHeader2
        '
        Me.ColumnHeader2.Text = "Latitude"
        Me.ColumnHeader2.Width = 70
        '
        'ColumnHeader3
        '
        Me.ColumnHeader3.Text = "Longitude"
        Me.ColumnHeader3.Width = 72
        '
        'cmdAutoDetectGpsPort
        '
        Me.cmdAutoDetectGpsPort.Location = New System.Drawing.Point(143, 29)
        Me.cmdAutoDetectGpsPort.Name = "cmdAutoDetectGpsPort"
        Me.cmdAutoDetectGpsPort.Size = New System.Drawing.Size(85, 20)
        Me.cmdAutoDetectGpsPort.TabIndex = 8
        Me.cmdAutoDetectGpsPort.Text = "&Auto Detect"
        '
        'Panel1
        '
        Me.Panel1.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _
                    Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
        Me.Panel1.Controls.Add(Me.Label1)
        Me.Panel1.Controls.Add(Me.cmdAutoDetectGpsPort)
        Me.Panel1.Controls.Add(Me.chkEnableLocation)
        Me.Panel1.Controls.Add(Me.ddlGpsPort)
        Me.Panel1.Location = New System.Drawing.Point(3, 128)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(228, 57)
        '
        'LocationForm
        '
        Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!)
        Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi
        Me.AutoScroll = True
        Me.ClientSize = New System.Drawing.Size(240, 188)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.lvLocationList)
        Me.Controls.Add(Me.lblDefaultLocation)
        Me.Menu = Me.mainMenu1
        Me.Name = "LocationForm"
        Me.Text = "LocationForm"
        Me.Panel1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub
    Friend WithEvents lblDefaultLocation As System.Windows.Forms.Label
    Friend WithEvents chkEnableLocation As System.Windows.Forms.CheckBox
    Friend WithEvents ddlGpsPort As System.Windows.Forms.ComboBox
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents gpsPort As System.IO.Ports.SerialPort
    Friend WithEvents lvLocationList As System.Windows.Forms.ListView
    Friend WithEvents ColumnHeader1 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader2 As System.Windows.Forms.ColumnHeader
    Friend WithEvents ColumnHeader3 As System.Windows.Forms.ColumnHeader
    Friend WithEvents cmdAutoDetectGpsPort As System.Windows.Forms.Button
    Friend WithEvents miOK As System.Windows.Forms.MenuItem
    Friend WithEvents miCancel As System.Windows.Forms.MenuItem
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
United States United States
I attended Southern Polytechnic State University and earned a Bachelors of Science in Computer Science and later returned to earn a Masters of Science in Software Engineering. I've largely developed solutions that are based on a mix of Microsoft technologies with open source technologies mixed in. I've got an interest in astronomy and you'll see that interest overflow into some of my code project articles from time to time.



Twitter:@j2inet

Instagram: j2inet


Comments and Discussions