Community of VE/MapPoint Users and Developers
This is a discussion on Linking to data using a UDL file (MapPoint 2006) within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi, I'm wondering if anyone can help me? I have a simple form in VB that contains one button and ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| I'm wondering if anyone can help me? I have a simple form in VB that contains one button and one MapPoint control. I'm only experimenting at this stage but would like the button to show/refresh data which is held on a SQL server using a UDL file. The form loads but error's when I click on the button. Here's all of the code currently attached to the form: Public Class MainForm Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AxMappointControl1.OpenMap("MyBlankMap.ptm") 'Display the toolbars AxMappointControl1.Toolbars.Item("location and scale").Visible = True AxMappointControl1.Toolbars.Item("navigation").Vis ible = True AxMappointControl1.Toolbars.Item("standard").Visib le = TrueEnd Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim objApp As MapPoint.Application Dim objDS As MapPoint.DataSet Dim objMap As MapPoint.Map objApp.Visible = True ' The debugger stops on this line objApp.UserControl = True Dim arrFields(0 To 11, 0 To 1) arrFields(0, 0) = "jobid" : arrFields(0, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(1, 0) = "jobtype" : arrFields(1, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(2, 0) = "assignedto" : arrFields(2, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(3, 0) = "actiondate" : arrFields(3, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(4, 0) = "externaluser" : arrFields(4, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(5, 0) = "complete" : arrFields(5, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(6, 0) = "name" : arrFields(6, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(7, 0) = "customerpriority" : arrFields(7, 1) = MapPoint.GeoFieldType.geoFieldData arrFields(8, 0) = "latitude" : arrFields(8, 1) = MapPoint.GeoFieldType.geoFieldLatitude arrFields(9, 0) = "logitude" : arrFields(9, 1) = MapPoint.GeoFieldType.geoFieldLongitude arrFields(10, 0) = "doorder" : arrFields(10, 1) = MapPoint.GeoFieldType.geoFieldData With objMap.DataSetsEnd SubobjDS = .LinkData("test.udl!Deliveries", arrFields, MapPoint.GeoCountry.geoCountryUnitedKingdom, MapPoint.GeoDelimiter.geoDelimiterDefault)End With End Class When I click the button I see the following errors: Variable 'objApp' is used before it has been assigned a value. A null reference exception could result at runtime. Variable 'objMap' is used before it has been assigned a value. A null reference exception could result at runtime. Any pointers (or tidied code) would be very much appreiciated. I have only ever done minimal coding in the past. Thanks Simon |
| |||
| Re: Linking to data using a UDL file (MapPoint 2006)
Hi Simon, This is because of the following. If you do: Code: Dim objApp As MapPoint.Application Code: objApp = CreateObject("MapPoint.Application.EU.13")
All the things you wants to do with Mappoint.Application you can do with the activeX control. Check therefore: Code: AxMappointControl1.ActiveMap....
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
![]() |
| Tags |
| data, file, linking, mappoint 2006, udl |
| ||||
| Posted By | For | Type | Date | |
| Microsoft MapPoint 2006 - MP2K Magazine | This thread | Refback | 02-28-2007 08:47 AM | |
| CRITERION CORPORATION - Company Directory - MP2K Magazine | This thread | Refback | 02-23-2007 06:54 AM | |
| Programming MapPoint in .NET - MP2K Magazine | This thread | Refback | 02-20-2007 10:11 AM | |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Opening a MP 2006 file in MP 2004, can it be done? | MtnDew2756 | MapPoint 2006/2009 Discussion | 4 | 08-24-2006 08:08 PM |
| Linking Data within an Excel Workbook to Mappoint | XLR Excel | MapPoint 2006/2009 Discussion | 0 | 07-06-2005 02:23 PM |
| Importing or linking data | alwasl8 | MapPoint 2006/2009 Discussion | 0 | 06-21-2005 01:47 PM |
| Linking to Weather Data From MapPoint | Anonymous | MP2K Magazine Articles | 1 | 11-01-2004 08:24 AM |
| linking to external file | sandiphw | MapPoint 2006/2009 Discussion | 2 | 12-18-2003 11:34 PM |