Answered by:
convert c# to vb...error in C# code

Question
-
User-1046621233 posted
Hey
I would like to know if someone can please help me
Im trying to convert C# to vb code...but somewhere there's a fault in the c#
and so this doesnt want to convert to vb
Can someone please help me with converting this code to vb
I tried all the converters on the net...there's a problem in the C# code...does anyone spot a problem in the C#?? ...can anyone maybe place this code in a converter an check to see what results you get???
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.arreglarMapa();
}
}
private void arreglarMapa()
{
GMap1.addControl(new GControl(GControl.preBuilt.LargeMapControl));
GMap1.enableHookMouseWheelToZoom = true;
StringBuilder sb = new StringBuilder();
sb.Append("function(marker, point) {");
GLatLng latlng = new GLatLng("point");
GInfoWindow window = new GInfoWindow(latlng, "<div style=\"height:140px;\"><blink>Loading...</blink></div>");
sb.Append(window.ToString(GMap1.GMap_Id));
sb.Append("}");
GMap1.addListener(new GListener(GMap1.GMap_Id, GListener.Event.click, sb.ToString()));
StringBuilder sb2 = new StringBuilder();
sb2.Append("function goTo(point){");
GLatLng point = new GLatLng("point");
sb2.AppendFormat("{0}.setZoom(11);", GMap1.GMap_Id);
GMove move = new GMove(1, point);
sb2.Append(move.ToString(GMap1.GMap_Id));
GMarker marker = new GMarker(point);
sb2.Append(marker.ToString(GMap1.GMap_Id));
sb2.Append("}");
GMap1.addCustomJavascript(sb2.ToString());
}
protected string GMap1_Click(object s, GAjaxServerEventArgs e)
{
inverseGeocodingManager igeoManager = new inverseGeocodingManager(e.point, "es");
inverseGeocoding iGeos = igeoManager.inverseGeoCodeRequest();
geoName geo;
if (iGeos.geonames.Count > 0)
{
geo = iGeos.geonames[0];
StringBuilder sb = new StringBuilder();
sb.Append("<div align=\"left\">");
sb.Append(""<b>Nearest Place "</b>");
sb.Append("<br />");
sb.AppendFormat("Place name: "<i>{0}"</i> ", geo.name);
sb.Append("<br />");
sb.AppendFormat("Point: "<i>{0}"</i>", geo.nearestPlacePoint.ToString());
sb.Append("<br />");
sb.AppendFormat("Elevation: "<i>{0}"</i>", geo.nearestPlaceElevation > -9000 ? geo.nearestPlaceElevation.ToString() : "No info");
sb.Append("<br />");
sb.AppendFormat("Country Name (Code): "<i>{0} ({1})"</i>", geo.countryName, geo.countryCode);
sb.Append("<br />");
sb.AppendFormat("Click point - Nearest Place distance (Km): "<i>{0}"</i>", Math.Round(geo.distance, 3));
sb.Append("</div>");
sb.Append("<br />");
sb.Append("<div align=\"left\">");
sb.Append(""<b>Click point"</b>");
sb.Append("<br />");
sb.AppendFormat("Point: "<i>{0}"</i>", geo.initialPoint.ToString());
sb.Append("<br />");
sb.AppendFormat("Elevation: "<i>{0}"</i>", geo.initialPointElevation > -9000 ? geo.initialPointElevation.ToString() : "No info");
sb.Append("<br />");
sb.Append("</div>");
GInfoWindow window = new GInfoWindow(e.point, sb.ToString(), true);
return window.ToString(e.map);
}
else return string.Empty;
}
Thank you for your help and time,I appreciate this a lot:)
Kind Regards
Jake
Thursday, September 10, 2009 2:28 PM
Answers
-
User397347636 posted
The original C# code has double quotes within non-verbatim strings which are not being escaped, so this C# code will not compile.
You can't expect any converter to handle code which is invalid.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 11, 2009 7:11 PM
All replies
-
User-720791821 posted
try using C# to vb converter which are available on the net http://www.developerfusion.com/tools/convert/csharp-to-vb/ http://www.kamalpatel.net/ConvertCSharp2VB.aspxThursday, September 10, 2009 2:37 PM -
User397347636 posted
The original C# code has double quotes within non-verbatim strings which are not being escaped, so this C# code will not compile.
You can't expect any converter to handle code which is invalid.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Friday, September 11, 2009 7:11 PM -
User-1046621233 posted
Hey
thank you for all the advise I recieved
I decided to discard the code
thank you again:)
Kind Regards
Jake
Monday, September 14, 2009 9:47 AM