VS2005, VB.Net Demo Project?

Oct 13, 2009 at 6:25 PM

I'd like to try out the control using VS2005 and VB.Net or VB2008 Express.

Should it work OK in VS2005? I have it  placed on form and somethings work but the image says "Sorry we don't have imagery for this zoom and region". I think I have reasonable values but maybe not:

 

    Private Sub Form1_Load(...
        map.MapType = GMap.NET.MapType.BingMap
        map.Zoom = 200000
        Dim code As GMap.NET.GeoCoderStatusCode = map.SetCurrentPositionByKeywords("San Luis Obispo,CA") ' code = success
        Debug.Print(map.CurrentPosition.ToString) '= {Lat=35.2827524, Lng=-120.6596156} 


I'm just trying got a hello world type project for now.
Anyone have a VB.Net demo form they would like to share?

 

Coordinator
Oct 13, 2009 at 6:32 PM
 map.Zoom = 200000 ;} max is almost for all 17
Oct 13, 2009 at 7:38 PM
Edited Oct 13, 2009 at 7:42 PM

Zoom setting doesn't seem to help - I still get the error that imagery is not available.

The default .Zoom =2 doesn't work.

Something more fundemental going on, some missing prequesite or setting?

Is there a way for me to send you my VB Express 2008 project for review?

Here's the complete code (copied mostly from CSharp demo):

Option Explicit On
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms
Imports GMap.NET
Imports GMap.NET.CacheProviders
Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers

Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'config(gmaps)
        GMaps.Instance.UseRouteCache = True
        GMaps.Instance.UseGeocoderCache = True
        GMaps.Instance.UsePlacemarkCache = True
        GMaps.Instance.Mode = AccessMode.ServerAndCache
        'config(map)
        map.MapType = MapType.ArcGIS_MapsLT_Map
        map.MaxZoom = 12
        map.MinZoom = 3
        map.Zoom = map.MinZoom
        map.CurrentPosition = New PointLatLng(54.6961334816182, 25.2985095977783)
        map.ZoomAndCenterMarkers("")
    End Sub
End Class
Coordinator
Oct 13, 2009 at 7:42 PM

target x86

Oct 13, 2009 at 7:47 PM

I'm a control user, and not a control developer - what does "target x86" mean?

Note that I am unable to load the CSharp source - I get an error about CSharp.targets missing - so I cannot build the control on my Vista PC (x86) under VS2005.

Coordinator
Oct 13, 2009 at 7:51 PM

set target on your project ;}

Oct 13, 2009 at 8:02 PM

Sorry - I don't think VB has the concept of a "target".

BTW the demo project does run on my PC.

Coordinator
Oct 13, 2009 at 8:05 PM

..and oh why &ms continues to use vb ;} let's hope they don't do it forever

Oct 13, 2009 at 8:13 PM

FYI

I created a new CSharpe project and added the GMap control to a form. I also added a reference to

GMap.NET.WindowsForms.dll and GMap.NET.Core.dll

I set MapType to Google and the form came up OK without any additional code and the tiles displayed.

I want to do the same thing with VB.

Why VB - C is great for systems/control development - it is very ineffecient when it comes to writing end user applications (IMHO.) And of course any competent C programmer can write a VB program (right?), but the opposite is not true.  :)

Coordinator
Oct 13, 2009 at 8:17 PM

;} ..well first try to put start code in constructor, not in load event

Oct 13, 2009 at 8:25 PM

VB does not have a Contructor event for the Form Class.

Thanks for your help! I don't want to take a bunch of your time.

Maybe someone that has worked in both envoironments can shed some light on the problems with VB. I can barely spell C#. I would guess it is something simple as the control you are developing shouldn't care what CLR/IDE they are used with.

Coordinator
Oct 13, 2009 at 8:38 PM
Edited Oct 13, 2009 at 8:40 PM

Option
Explicit On
Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms
Imports GMap.NET
Imports GMap.NET.CacheProviders
Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers

Public Class Form1
   Sub New()

      InitializeComponent()

      'config(gmaps)
      GMaps.Instance.UseRouteCache = True
      GMaps.Instance.UseGeocoderCache = True
      GMaps.Instance.UsePlacemarkCache = True
      GMaps.Instance.Mode = AccessMode.ServerAndCache

      'config(map)
      GMapControl1.MapType = MapType.OpenStreetMapSurfer
      GMapControl1.MaxZoom = 19
      GMapControl1.MinZoom = 6
      GMapControl1.Zoom = GMapControl1.MinZoom
      GMapControl1.CurrentPosition = New PointLatLng(54.6961334816182, 25.2985095977783)
   End Sub
End Class

// works perfect ;}

Oct 13, 2009 at 10:24 PM
Edited Oct 13, 2009 at 10:25 PM

Thanks!

What I was missing was a reference to System.Data.SQLite.dll in the VB Project. I'm suprised I didn't get an error....

Below is my "final" hello world code for VS2005 VB.Net.

<font size="2">

InitializeComponent

</font>

InitializeComponent() sub is called automatically and is not usually visable to the VB coder.  (Do a Solution wide search for InitializeComponent to see the code which should not be modifed.)

The initial map properties are set in Form_Load(). I'm not sure all the setup code/Imports are required as I just copied it from a CSharp sample.

 When you first drop a map control on a form set the MapType property manually as the absence of a valid default causes an error when you try to save the project(bug?). My control was named 'map' for this example (avoid the name GMap.)

radio - thanks for your help! Great control!

Option Explicit On

Imports System
Imports System.Collections.Generic
Imports System.Drawing
Imports System.Globalization
Imports System.Windows.Forms
Imports GMap.NET
Imports GMap.NET.CacheProviders
Imports GMap.NET.WindowsForms
Imports GMap.NET.WindowsForms.Markers
' Project refernces required:
'   GMap.NET.Core.dll
'   GMap.NET.WindowsForms.dll
'   System.Data.SQLite.dll
Public Class Form1
    Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        'config(gmaps)
        GMaps.Instance.UseRouteCache = True
        GMaps.Instance.UseGeocoderCache = True
        GMaps.Instance.UsePlacemarkCache = True
        GMaps.Instance.Mode = AccessMode.ServerAndCache

        'config(map)
        map.MapType = MapType.GoogleHybrid
        map.MaxZoom = 19
        map.MinZoom = 6
        map.Zoom = map.MinZoom
        'map.CurrentPosition = New PointLatLng(54.6961334816182, 25.2985095977783)
        map.SetCurrentPositionByKeywords("San Luis Obispo, CA")

    End Sub
End Class

 

Coordinator
Oct 14, 2009 at 5:13 AM

great, i'll try to fix design mode ;}