none
Bing Maps 8 and Windows Forms WebBrowser control Failure RRS feed

  • Question

  • My script works fine w/ FireFox, IE 11, and Chrome but not with Windows.Forms.WebBrowser - no error, just a blank control.  Am I missing something?

    Link to the script via -

           WebBrowser1.Navigate(New Uri(cFile))

    cFile contents:

    <!DOCTYPE html>
    <html>
    <head>
    <title>Service Map</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta charset="utf-8" />
    <script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
    <script type='text/javascript'>
    var map;
    function GetMap() {
    map = new Microsoft.Maps.Map('#myMap', {
    credentials: ' your key ', 
    center: new Microsoft.Maps.Location(34.0182,-118.1133)
    });
    var center = map.getCenter();
    var pin = new Microsoft.Maps.Pushpin(center, {
    title: '',subTitle: '',text: '*'});
    map.entities.push(pin);
    }
    </script>
    </head>
    <body>
    <div id="myMap" style="; height: 770px; width: 1125px;"></div>
    </body>
    </html>


    hpw

    Wednesday, November 8, 2017 5:41 PM

Answers

  • Try this code sample: https://code.msdn.microsoft.com/bing/Using-the-Bing-Maps-V8-Web-07e21f3a?redir=0 to see if that works for you. I don't see any glaring issues in your code.

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Friday, November 10, 2017 1:49 AM
    • Marked as answer by HowardW Friday, November 10, 2017 4:54 AM
    Friday, November 10, 2017 1:49 AM
  • Thanks.  I tried the sample code - same result - nothing displaying in the WebBrowser control.  However, the same file opened with Chrome shows a map.

    My vb .net code:

    WebBrowser1.Url = New Uri(cFile)

    Project is .Net Framework 4 Client Profile and I have modified my registry to use IE 11 for my executable. 

    I created a new simple project with .Net 4.6.1 and I get a map!  My issue apparently was with the use of an old version of .Net!


    hpw

    • Marked as answer by HowardW Friday, November 10, 2017 4:54 AM
    Friday, November 10, 2017 4:53 AM

All replies

  • Try this code sample: https://code.msdn.microsoft.com/bing/Using-the-Bing-Maps-V8-Web-07e21f3a?redir=0 to see if that works for you. I don't see any glaring issues in your code.

    [Blog] [twitter] [LinkedIn]

    • Proposed as answer by Ricky_Brundritt Friday, November 10, 2017 1:49 AM
    • Marked as answer by HowardW Friday, November 10, 2017 4:54 AM
    Friday, November 10, 2017 1:49 AM
  • Thanks.  I tried the sample code - same result - nothing displaying in the WebBrowser control.  However, the same file opened with Chrome shows a map.

    My vb .net code:

    WebBrowser1.Url = New Uri(cFile)

    Project is .Net Framework 4 Client Profile and I have modified my registry to use IE 11 for my executable. 

    I created a new simple project with .Net 4.6.1 and I get a map!  My issue apparently was with the use of an old version of .Net!


    hpw

    • Marked as answer by HowardW Friday, November 10, 2017 4:54 AM
    Friday, November 10, 2017 4:53 AM