locked
VB String to Javascript?

    Question

  • Hello,

    I´m trying to give a VB String into a Javascript, but I can´t figure out how to do it..

    Did you have some help for me ?

    Thanks in advance

    Thursday, April 17, 2014 10:33 PM

All replies

  • Can you explain the scenario more clearly? How are your VB code and JavaScript code related? Are you writing a Windows Runtime Component in VB and trying to consume it from JavaScript?

    See Walkthrough: Creating a simple component in C# or Visual Basic and calling it from JavaScript

    --Rob

    Thursday, April 17, 2014 11:03 PM
    Owner
  • Hi Rob Thank you for your answer!

    No I´m writing a Windows Store app, the Javascript is in a HTML file within the project

    I want to add multiple Point with this Javascript string to a map.

    var poi = new MQA.Poi({ lat: 30.735383, lng: -73.984655 });
                poi.setRolloverContent('Rollover dfasfasd for New York, NY');
                poi.setInfoContentHTML('InfoWindow Content for New York, NY');
    
                map.addShape(poi);

    In VB with a FOR loop I get multiple location String and I save them as a VB String

    For Each Item In ls_geraeteid.Items
                    nummer.cmd.CommandText = "SELECT GPS_lon, GPS_lat FROM tbl_device WHERE Device_ID='" & ls_geraeteid.SelectedItem & "'"
                    mysql.sqlohnestringread()
                    Do While nummer.read.Read
                        nummer.tracking = "new MQA.Poi({ lat: nummer.read("GPS_lat"), lng: nummer.read("GPS_lon") });" & " " & _
                        "poi.setRolloverContent('Rollover dfasfasd for New York, NY');" & " " & _
                        "poi.setInfoContentHTML('InfoWindow Content for New York, NY');" & " " & _
                        "map.addShape(poi);" & " " & nummer.tracking
                    Loop
                    nummer.con.Close()

    And I want to give this VB String to the Javascript.


    • Edited by Uriziel Friday, April 18, 2014 9:41 AM
    Friday, April 18, 2014 9:16 AM
  • Can you explain the scenario more clearly? How are your VB code and JavaScript code related? Are you writing a Windows Runtime Component in VB and trying to consume it from JavaScript?

    See ...

    --Rob

    I tried the example from your link but I always get this error

    "0x800a1391 - Laufzeitfehler in JavaScript: "SampleComponent" ist undefiniert"

    Runtime error in JavaScript: "Sample Component" is undefined

    It´s reallybad that the windows example isn´t working and I got no Idea of Javasript..

    Friday, April 18, 2014 1:52 PM
  • I'm assuming that you are passing this to JavaScript to show it on a map. Why not use the Bing Maps SDK in VB. You will have better performance than using a JavaScript Map Control. Also the free terms of use for the Bing Maps SDK is double any other map control out there. If you need info on how to use Bing Maps in VB take a look at my free ebook on creating location intelligent Windows Store apps: http://rbrundritt.wordpress.com/my-book/

    http://rbrundritt.wordpress.com

    Monday, April 21, 2014 9:22 AM