<?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>Wizz's Coding Solutions &#187; Windows Forms</title>
	<atom:link href="http://rainstorms.me.uk/blog/tag/windows-forms/feed/" rel="self" type="application/rss+xml" />
	<link>http://rainstorms.me.uk/blog</link>
	<description>Problems that I come across in day to day coding</description>
	<lastBuildDate>Thu, 07 Jul 2011 07:50:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Windows Forms controls and the red X</title>
		<link>http://rainstorms.me.uk/blog/2009/12/17/windows-forms-controls-and-the-red-x/</link>
		<comments>http://rainstorms.me.uk/blog/2009/12/17/windows-forms-controls-and-the-red-x/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 12:26:48 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Exception]]></category>
		<category><![CDATA[paint]]></category>
		<category><![CDATA[red x]]></category>
		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=283</guid>
		<description><![CDATA[I have been working on a project where certain controls randomly seem to come up with a red X and a red border around it.  I wasn&#8217;t sure what was causing it, but it turns out it is when an exception is thrown by code in the paint event.  For more details, see the following [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I have been working on a project where certain controls randomly seem to come up with a red X and a red border around it.  I wasn&#8217;t sure what was causing it, but it turns out it is when an exception is thrown by code in the paint event.  For more details, see the following blog from sturmnet.org:  <a href="http://www.sturmnet.org/blog/2005/03/23/red-x">WinForms controls and the red X</a>.</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;t=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;title=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F12%2F17%2Fwindows-forms-controls-and-the-red-x%2F&amp;t=Windows+Forms+controls+and+the+red+X" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2009/12/17/windows-forms-controls-and-the-red-x/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting the .NET WebBrowser Control&#8217;s DocumentText Property</title>
		<link>http://rainstorms.me.uk/blog/2009/06/30/setting-the-net-webbrowser-controls-documenttext-property/</link>
		<comments>http://rainstorms.me.uk/blog/2009/06/30/setting-the-net-webbrowser-controls-documenttext-property/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 21:28:01 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[DocumentText]]></category>
		<category><![CDATA[WebBrowser]]></category>
		<category><![CDATA[Windows Forms]]></category>
		<category><![CDATA[Workarounds]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=178</guid>
		<description><![CDATA[The .NET framework comes with a nice WebBrowser control, which is a wrapper around MS Internet Explorer.  The problem is that it can be rather quirky at times, and one of these times is when you try to set the DocumentText property from code.  It might work, and then again it might not.  It is [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>The .NET framework comes with a nice WebBrowser control, which is a wrapper around MS Internet Explorer.  The problem is that it can be rather quirky at times, and one of these times is when you try to set the DocumentText property from code.  It <em>might</em> work, and then again it might not.  It is quite difficult to pin down exactly when it does work and when it doesn&#8217;t, but the following bit of code seems to set it for me&#8230;</p>
<pre name="code" class="vb.net">
  wbMsg.AllowNavigation = False
        wbMsg.AllowNavigation = True

        If wbMsg.Document Is Nothing Then
            wbMsg.DocumentText = s
        Else
            wbMsg.Document.OpenNew(True)
            wbMsg.Document.Write(s)
        End If
</pre>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;t=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;title=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F06%2F30%2Fsetting-the-net-webbrowser-controls-documenttext-property%2F&amp;t=Setting+the+.NET+WebBrowser+Control%26%238217%3Bs+DocumentText+Property" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2009/06/30/setting-the-net-webbrowser-controls-documenttext-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Forms DateTimePicker ShowCheckBox and not Checked bug in .NET 2.0</title>
		<link>http://rainstorms.me.uk/blog/2009/03/09/windows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20/</link>
		<comments>http://rainstorms.me.uk/blog/2009/03/09/windows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 14:25:20 +0000</pubDate>
		<dc:creator>wizzard</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[.NET 2.0]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[Control]]></category>
		<category><![CDATA[DateTimePicker]]></category>
		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://rainstorms.me.uk/blog/?p=102</guid>
		<description><![CDATA[I recently upgraded a project that I had inherited from another programmer to .NET 2.0. Shortly after, I received an email complaining that a date field had stopped saving correctly. I tried it out, and all looked fine in the user interface, but sure enough, the value was not being written to the database. It [...]


No related posts.

Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded a project that I had inherited from another programmer to .NET 2.0.  Shortly after, I received an email complaining that a date field had stopped saving correctly.  I tried it out, and all looked fine in the user interface, but sure enough, the value was not being written to the database.  </p>
<p>It took me some time to work out what was going on.  The ShowCheckBox property was set to False, but the Checked property also was.  For some reason, the DateTimePicker in .NET 2.0 interprets this as meaning that the value that is in the control is to be ignored, and it returns today&#8217;s date if you access the Value property.  </p>
<p>This was a pretty simple fix &#8211; all it took was to set Checked to True, and it all worked fine again.  It is an interesting gotcha to look out for though &#8211; I haven&#8217;t seen it documented anywhere as a breaking change of .NET 2.0</p>
<!-- Social Bookmarks BEGIN -->
<div class="social_bookmark">
<a><strong><em>Bookmark this post</em></strong></a>
<br />
<div class="d">
<br />
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://del.icio.us/post?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;Del.icio.us"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/delicious.png" title="Add to&nbsp;Del.icio.us" alt="Add to&nbsp;Del.icio.us" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://digg.com/submit?phase=2&amp;url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;digg"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/digg.png" title="Add to&nbsp;digg" alt="Add to&nbsp;digg" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.dotnetkicks.com/kick/?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;DotNetKicks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/dotnetkicks.png" title="Add to&nbsp;DotNetKicks" alt="Add to&nbsp;DotNetKicks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.facebook.com/sharer.php?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F" rel="nofollow" title="Add to&nbsp;Facebook"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/facebook.png" title="Add to&nbsp;Facebook" alt="Add to&nbsp;Facebook" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://FriendSite.com/users/bookmarks/?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;t=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;FriendSite"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/friendsite.png" title="Add to&nbsp;FriendSite" alt="Add to&nbsp;FriendSite" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;Google Bookmarks"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/google.png" title="Add to&nbsp;Google Bookmarks" alt="Add to&nbsp;Google Bookmarks" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://reddit.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;reddit"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/reddit.png" title="Add to&nbsp;reddit" alt="Add to&nbsp;reddit" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://slashdot.org/bookmark.pl?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;Slashdot"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/slashdot.png" title="Add to&nbsp;Slashdot" alt="Add to&nbsp;Slashdot" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.stumbleupon.com/submit?url=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;title=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;Stumble Upon"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/stumbleupon.png" title="Add to&nbsp;Stumble Upon" alt="Add to&nbsp;Stumble Upon" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.shoutwire.com/?p=submit&amp;link=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F" rel="nofollow" title="Add to&nbsp;Shoutwire"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/shoutwire.png" title="Add to&nbsp;Shoutwire" alt="Add to&nbsp;Shoutwire" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://www.technorati.com/faves?add=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F" rel="nofollow" title="Add to&nbsp;Technorati"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/technorati.png" title="Add to&nbsp;Technorati" alt="Add to&nbsp;Technorati" /></a>
<a onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http%3A%2F%2Frainstorms.me.uk%2Fblog%2F2009%2F03%2F09%2Fwindows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20%2F&amp;t=Windows+Forms+DateTimePicker+ShowCheckBox+and+not+Checked+bug+in+.NET+2.0" rel="nofollow" title="Add to&nbsp;Yahoo My Web"><img class="social_img" src="http://rainstorms.me.uk/blog/wp-content/plugins/social-bookmarks/images/yahoo.png" title="Add to&nbsp;Yahoo My Web" alt="Add to&nbsp;Yahoo My Web" /></a>
<br />
</div>
</div>
<!-- Social Bookmarks END -->


<p>No related posts.</p>
<p>Related posts brought to you by <a href='http://yarpp.org'>Yet Another Related Posts Plugin</a>.</p>]]></content:encoded>
			<wfw:commentRss>http://rainstorms.me.uk/blog/2009/03/09/windows-forms-datetimepicker-showcheckbox-and-not-checked-bug-in-net-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

