title: Creating a dynamically changing HTML script for a windows forms container
body: <p>I am currently trying to integrate a weather module into my software from a freely available source and i can get my form to load if i write the code as follows:</p>
  
  <pre><code>WebBrowser1.DocumentText = "&lt;html&gt;&lt;img src=http://www.7timer.info/bin/astro.php?lon=-2.36&amp;lat=55.91&amp;lang=en&amp;ac=0&amp;unit=metric&amp;tzshift=0 &lt;/html&gt;";
  </code></pre>
  
  <p>What i want to do however is be able to dynamically alter the html code by using global variables defined in the parent form to insert the corrected lattitude and longitude into the code. The idea being that the user can enter their Lat/Lon on the parent form where it is used for other purposes but those values will then be the base for generating a corrected local weather forecast. 
  The code i have to do this is:</p>
  
  <pre><code>string myweather = "&lt;html&gt;&lt;img scr=http://www.7timer.info/bin/astro.php?lon=" + Global_Variables.Longitude + "&amp;lat=" + Global_Variables.Lattitude + "&amp;lang=en&amp;ac=0&amp;unit=metric&amp;tzshift=0 &lt;/html&gt;";
  WebBrowser1.DocumentText = myweather;
  </code></pre>
  
  <p>Method 1 works just fine and the form populates with the weather forecast but when i use method 2 the form is always blank. I have used the debugger and written out the value generated by metho2 2 and it returns exactly the same as what was defined in method 1. I have tried various iterations such as </p>
  
  <pre><code>WebBrowser1.DocumentText = (char)34+myweatheer+(char)34
  </code></pre>
  
  <p>and also having it as a variable instead of a string but nothing i seem to do makes any difference and the (char)34 method only drops quotation marks into the form with a gap inbetween and the rest of the form is blank. I really cant understand how a different method that returns exactly the same value does not seem to work?</p>
  
  <p>There is literally no more code within the form itself as it's only purpose is to be a pop up child form that displays a graphical weather forecast. When a button is clicked on the parent form then this one opens up and contains only a web browser container with this html code inserted into the container. If i go to the website referenced in the code there are option for setting parameters and generating the html string that can be copied and pasted into your own website if you wish. Alternately you can write your own string in the correct format to make the same query and return an image with the weather forecast. In fact if i take the resulting output of "myweather" without the "" and paste it into a web browser i do actually get the web browser showing exactly the image i am expecting. I have edited the original post to be clearer as to the default container name instead of my custom name.</p>