Click here to Skip to main content
15,891,431 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionControl Object Created or Initialized Pin
Samir Ibrahim6-May-09 0:54
Samir Ibrahim6-May-09 0:54 
AnswerRe: Control Object Created or Initialized Pin
Mycroft Holmes6-May-09 1:21
professionalMycroft Holmes6-May-09 1:21 
QuestionVirtual Earth Bespoke Map Control Pin
Lexter33335-May-09 22:29
Lexter33335-May-09 22:29 
AnswerRe: Virtual Earth Bespoke Map Control Pin
Dave Kreskowiak6-May-09 2:19
mveDave Kreskowiak6-May-09 2:19 
QuestionProblem with API Pin
Pasan1485-May-09 21:44
Pasan1485-May-09 21:44 
AnswerRe: Problem with API Pin
Henry Minute6-May-09 6:04
Henry Minute6-May-09 6:04 
AnswerRe: Problem with API Pin
Bharat Jain6-May-09 18:51
Bharat Jain6-May-09 18:51 
QuestionVirtual Earth Map Control without using AJAX Pin
Lexter33335-May-09 20:41
Lexter33335-May-09 20:41 
Hi,
I think I got this ASP.NET Server Control code from here. It works in Firefox but not in IE. Does anyone know why?

ASP.net 2.0
Language - VB
Site Content Manager – Dot Net Nuke

VB Code:

Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.ComponentModel
Imports System.Collections


Public Class MapControl
Inherits WebControl
#Region "Variables"
Private _dataSource As IEnumerable
Private _VarMap As String = "var map = null;"
Private _GetMapOpen As String = "function GetMap(){"
Private _CloseBracket As String = "}"
Private _LoadMap As String = "map.LoadMap();"
Private _PinId1 As String = "var pinid1=0;"
Private _Locs1Array As String = "var locs1 = new Array;"
Private _MapAddPushpin As String = "map.AddPushpin(pin);"
Private _IncrementPinId As String = "pinid1++;"
Private _Latitude As String = "47.6"
Private _Longitude As String = "-122.33"
Private _ZoomLevel As Integer = 10
#End Region
#Region "Properties"
Public Property DataSource() As IEnumerable
Get
Return _dataSource
End Get
Set(ByVal value As IEnumerable)
_dataSource = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Latitude() As String
Get
Return _Latitude
End Get
Set(ByVal value As String)
_Latitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property Longitude() As String
Get
Return _Longitude
End Get
Set(ByVal value As String)
_Longitude = value
End Set
End Property
<Browsable(True), Category("Position")> _
Public Property ZoomLevel() As Integer
Get
Return _ZoomLevel
End Get
Set(ByVal value As Integer)
_ZoomLevel = value
End Set
End Property

#End Region
#Region "String Functions"
Private Function NewNamedMap(ByVal MapName As String) As String
Return "map = new VEMap('" & MapName & "');"
End Function
Private Function NewLocation(ByVal longatude As String, ByVal latitude As String) As String
Return "var loc = new VELatLong(" & longatude & "," & latitude & ");"
End Function
Private Function AddPushPin(ByVal Arr As String, ByVal Location As String) As String
Return Arr & ".push(" & Location & ");"
End Function
Private Function ForOpen(ByVal Arr As String) As String
Return "for (i=0; i < " & Arr & ".length; i++){"
End Function
Private Function RunBestMap(ByVal Arr As String) As String
Return "DoBestMap(" & Arr & ");"
End Function
#End Region
#Region "Map Strings"
Private Function MapWithDatasource() As String
Dim str As String = ""
str &= "<script "
str &= "type=""text/javascript"""
str &= ">"
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap
str &= _Locs1Array
str &= _PinId1

Dim DataEnum As IEnumerator
DataEnum = DataSource.GetEnumerator()
Dim i As Integer = 0
'str &= ForOpen("locs1")
While (DataEnum.MoveNext())
Dim st1, st2, st3, st4 As String
st1 = DataEnum.Current
DataEnum.MoveNext()
st2 = DataEnum.Current
DataEnum.MoveNext()
st3 = DataEnum.Current
DataEnum.MoveNext()
st4 = DataEnum.Current
str &= NewLocation(st1, st2)
str &= AddPushPin("locs1", "loc")
str &= "var pin = new VEPushpin(" & i.ToString & ", locs1[" & i.ToString & "], null, '" & st3 & "', '" & st4 & "');"
str &= "map.AddPushpin(pin);"
i += 1
End While
'str &= _CloseBracket
str &= "map.SetMapView(locs1);"
str &= _CloseBracket
str &= "</script>"
Return str
End Function
Private Function BasicMap() As String
Dim str As String = ""
str = "<script ""language=""JavaScript"">"
If Latitude <> "" And Longitude <> "" Then
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _
"map.LoadMap(new VELatLong(" & Latitude.ToString & "," & Longitude.ToString & "), " & ZoomLevel.ToString & ",'h' ,false);" & _CloseBracket
Else
str &= _GetMapOpen & _VarMap & NewNamedMap("MyNewMap") & _LoadMap & _CloseBracket
End If
str &= "</script>"
Return str
End Function
#End Region
#Region "Control Methods"
Protected Overrides Sub OnPreRender(ByVal e As System.EventArgs)
MyBase.OnPreRender(e)
Dim meta As String = "<meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"">"
Dim link As String = "<script type=""text/javascript"" src=""http://dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=6.2""></script>"
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Meta", meta)
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "Link", link)
Controls.Add(New LiteralControl("<div id='MyNewMap' style=""position:relative; width:600px; height:300px;""></div>"))
If Not _dataSource Is Nothing Then
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", MapWithDatasource)
Else
Me.Page.ClientScript.RegisterClientScriptBlock(GetType(String), "OnLoad", BasicMap)
End If


End Sub
Protected Overrides Sub OnDataBinding(ByVal e As EventArgs)
Controls.Clear()
End Sub
#End Region
End Class
AnswerRe: Virtual Earth Map Control without using AJAX Pin
Mycroft Holmes5-May-09 21:21
professionalMycroft Holmes5-May-09 21:21 
Questionmicrosoft report viewer in visual studio does not function with a stored procedure Pin
sourav_bhargava5-May-09 20:31
sourav_bhargava5-May-09 20:31 
AnswerRe: microsoft report viewer in visual studio does not function with a stored procedure Pin
Mycroft Holmes5-May-09 21:20
professionalMycroft Holmes5-May-09 21:20 
GeneralRe: microsoft report viewer in visual studio does not function with a stored procedure Pin
sourav_bhargava5-May-09 21:27
sourav_bhargava5-May-09 21:27 
GeneralRe: microsoft report viewer in visual studio does not function with a stored procedure Pin
Mycroft Holmes5-May-09 21:41
professionalMycroft Holmes5-May-09 21:41 
GeneralRe: microsoft report viewer in visual studio does not function with a stored procedure Pin
sourav_bhargava5-May-09 23:06
sourav_bhargava5-May-09 23:06 
GeneralRe: microsoft report viewer in visual studio does not function with a stored procedure Pin
sourav_bhargava5-May-09 23:21
sourav_bhargava5-May-09 23:21 
Questionproblem of checklistbox Pin
nazimghori5-May-09 17:38
nazimghori5-May-09 17:38 
QuestionDisposing of images in GDI+ Pin
Alan Burkhart5-May-09 16:17
Alan Burkhart5-May-09 16:17 
AnswerRe: Disposing of images in GDI+ Pin
Christian Graus5-May-09 17:02
protectorChristian Graus5-May-09 17:02 
GeneralRe: Disposing of images in GDI+ Pin
Alan Burkhart5-May-09 18:11
Alan Burkhart5-May-09 18:11 
QuestionPrinting Problem (Jump to next Page) Pin
Zaegra5-May-09 5:37
Zaegra5-May-09 5:37 
AnswerRe: Printing Problem (Jump to next Page) Pin
Dave Kreskowiak5-May-09 5:48
mveDave Kreskowiak5-May-09 5:48 
QuestionSend email VB 2008 and outlook 2003 Pin
Member 22887045-May-09 1:52
Member 22887045-May-09 1:52 
AnswerRe: Send email VB 2008 and outlook 2003 Pin
Mycroft Holmes5-May-09 17:26
professionalMycroft Holmes5-May-09 17:26 
GeneralRe: Send email VB 2008 and outlook 2003 Pin
Member 22887046-May-09 1:41
Member 22887046-May-09 1:41 
GeneralRe: Send email VB 2008 and outlook 2003 Pin
Dave Kreskowiak6-May-09 2:16
mveDave Kreskowiak6-May-09 2:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.