<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Vacheslav Starikov&#039;s &#187; c#</title>
	<atom:link href="http://starikovs.com/cat/c/feed/" rel="self" type="application/rss+xml" />
	<link>http://starikovs.com</link>
	<description>BLOG</description>
	<lastBuildDate>Sun, 05 Sep 2010 18:05:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Converting String to Single in C#</title>
		<link>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/</link>
		<comments>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/#comments</comments>
		<pubDate>Tue, 16 Mar 2010 17:09:45 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=214</guid>
		<description><![CDATA[Some time ago, I needed to get Flash Movie sizes inside of my C# code. I googled and I found some great examples of how I can do it. It was Mike Swanson&#8217;s example project called FlashTools. I downloaded it and stated to use. While I was using this code I found a little bug [...]]]></description>
			<content:encoded><![CDATA[<p>Some time ago, I needed to get Flash Movie sizes inside of my C# code. I googled and I found some great examples of how I can do it. It was <a href="http://blogs.msdn.com/mswanson/" target="_blank">Mike Swanson&#8217;s</a> example project called FlashTools. I downloaded it and stated to use. While I was using this code I found a little bug that was occured depending of regional settings in the system. An error occured when FlashTools library tryed to convert String to Single. When I used English locale everything was going OK but when I changed the locale I got &#8220;Input string was not in a correct format&#8221;. A fix was very simple, I just passed the <code>InvariantCulture</code> as the second parameter of <code>Convert.ToSingle</code> method.<br />
<span id="more-214"></span><br />
A code snippet that causes an error:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// private Single frameRate = 0.0F;</span>
<span style="color: #FF0000;">string</span> sFrameRate <span style="color: #008000;">=</span> <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{0}.{1}&quot;</span>, frameRateMajor, frameRateMinor<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">frameRate</span> <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToSingle</span><span style="color: #000000;">&#40;</span>sFrameRate<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>A workaround:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #008080; font-style: italic;">// private Single frameRate = 0.0F;</span>
<span style="color: #FF0000;">string</span> sFrameRate <span style="color: #008000;">=</span> <span style="color: #FF0000;">String</span>.<span style="color: #0000FF;">Format</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;{0}.{1}&quot;</span>, frameRateMajor, frameRateMinor<span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
<span style="color: #0600FF;">this</span>.<span style="color: #0000FF;">frameRate</span> <span style="color: #008000;">=</span> Convert.<span style="color: #0000FF;">ToSingle</span><span style="color: #000000;">&#40;</span>sFrameRate, 
  <span style="color: #000000;">System.<span style="color: #0000FF;">Globalization</span></span>.<span style="color: #0000FF;">CultureInfo</span>.<span style="color: #0000FF;">InvariantCulture</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>Using the <code>System.Globalization.CultureInfo.InvariantCulture</code> the <code>Convert.ToSingle</code> method converts String to Single using the specified culture-specific formatting information.</p>
<h3>Links</h3>
<p><a href="http://blogs.msdn.com/mswanson/archive/2006/10/15/example-c-code-for-reading-flash-swf-files.aspx" target="_blank">Example C# Code for Reading Flash (SWF) Files</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/w7zs80w4%28VS.85%29.aspx" target="_blank">Convert.ToSingle Method</a></p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2010/03/16/converting-string-to-single-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting HTML for WebBrowser in C#</title>
		<link>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/</link>
		<comments>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/#comments</comments>
		<pubDate>Wed, 25 Nov 2009 16:39:53 +0000</pubDate>
		<dc:creator>Vacheslav</dc:creator>
				<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://starikovs.com/?p=155</guid>
		<description><![CDATA[Today I tryed to insert HTML for WebBorwser in C#. I thought it&#8217;s a simple task. But when I tryed to use DocumentText property I got &#8220;&#60;HTML&#62;&#60;/HTML&#62;&#8221;. Then I tryed Document.Write("...") and I got that Document is null. After these tries I started to find out the easiest way to fill the WebBrowser with HTML [...]]]></description>
			<content:encoded><![CDATA[<p>Today I tryed to insert HTML for <code>WebBorwser</code> in C#. I thought it&#8217;s a simple task. But when I tryed to use <code>DocumentText</code> property I got &#8220;&lt;HTML&gt;&lt;/HTML&gt;&#8221;. Then I tryed <code>Document.Write("...")</code> and I got that <code>Document</code> is <code>null</code>. After these tries I started to find out the easiest way to fill the WebBrowser with HTML without writing to disk and navigating the written file. Here is my code:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">WebBrowser browser <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> WebBrowser<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
&nbsp;
browser.<span style="color: #0000FF;">Navigate</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;about:blank&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span>
browser.<span style="color: #0000FF;">Document</span>.<span style="color: #0000FF;">Write</span><span style="color: #000000;">&#40;</span><span style="color: #666666;">&quot;&lt;html&gt;&lt;body&gt;...&lt;/body&gt;&lt;/html&gt;&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>When the <code>WebBrowser</code> has been made, the <code>Document</code> object is <code>null</code>. So, we should call <code>Navigate()</code> method to get <code>Document</code> available.</p>
<p>If You have Your way to fill the <code>WebBrowser</code> with HTML I&#8217;m expecting for Your comments <img src='http://starikovs.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://starikovs.com/2009/11/25/set-html-webbrowser-csharp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
