<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Bite The Wax Tadpole</title>
	<atom:link href="http://waxtadpole.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://waxtadpole.wordpress.com</link>
	<description>.NET Journeys In Pain</description>
	<lastBuildDate>Fri, 06 Nov 2009 08:51:19 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='waxtadpole.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/c83d950f95f42e0507fd534ba3f8d34b?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Bite The Wax Tadpole</title>
		<link>http://waxtadpole.wordpress.com</link>
	</image>
			<item>
		<title>Visual Studio 2008 Disappears From Screen When Loading Solution or Project</title>
		<link>http://waxtadpole.wordpress.com/2009/11/05/visual-studio-2008-disappears-from-screen-when-loading-solution-or-project/</link>
		<comments>http://waxtadpole.wordpress.com/2009/11/05/visual-studio-2008-disappears-from-screen-when-loading-solution-or-project/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 11:23:56 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[Ferret (Emergency)]]></category>
		<category><![CDATA[Sponteneous Combustion]]></category>
		<category><![CDATA[Alice In Wonderland]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=910</guid>
		<description><![CDATA[I started up Visual Studio 2008 and clicked on my Solution file AmazingSolution on the Start Page. Visual Studio started dragging up the solution and was just loading up a XAML file when it disappeared. Just disappeared. 
This was about as expected as a nasty case of Sponteneous Combustion. Alice In Wonderland is one of [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=910&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I started up Visual Studio 2008 and clicked on my Solution file <em>AmazingSolution</em> on the Start Page. Visual Studio started dragging up the solution and was just loading up a XAML file <em>when it disappeared</em>. Just <em>disappeared</em>. </p>
<p>This was about as expected as a nasty case of <a href="http://www.youtube.com/watch?v=draua97qH1Y">Sponteneous Combustion</a>. <em>Alice In Wonderland</em> is one of my favourite books but when Visual Studio starts behaving like the Chesire Cat it&#8217;s a little perturbing&#8230;<strong>more so since I had just hacked the Registry</strong> to overcome the issue of <a href="http://social.msdn.microsoft.com/forums/en-US/windowssdk/thread/dd6f14ed-e582-4b49-9358-64f2afaec151/">Intellisense not appearing in XAML files after installation of Windows SDK</a>.</p>
<p><a href="http://www.lyricsmode.com/lyrics/b/billy_bragg/love_gets_dangerous.html">My terror was complete</a>. <strong>I had destroyed Visual Studio.</strong></p>
<p>The paramedics were called, the Emergency Sacrifical Ferret put on stand-by and I ran a repair on Visual Studio, as Microsoft Connect recommended.</p>
<p>Then I rebooted, restarted Visual Studio and loaded <em>AmazingProject</em>. Visual Studio disappeared <em>again</em>. I slaughtered the Ferret and ordered a crate of Vodka in celebration of my impending sacking, but then checked the Event Logs. Glory! It contained a very useful entry:</p>
<p><strong>.NET Runtime version 2.0.50727.3603 &#8211; Fatal Execution Engine Error (7A036050) (80131506)</strong></p>
<p>and Googling that showed that <a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827.">Microsoft Connect have patch files for that very issue</a>&#8230;Well, it was too late for the Ferret, but I HADN&#8221;T DESTROYED VISUAL STUDIO AFTER ALL!</p>
<p><strong>To Summarize</strong></p>
<p>1. The horrifying sudden disappearance of Visual Studio 2008 can be caused by a bug relating to the loading of XAML files. Check your Event Logs and if you see <em>.NET Runtime version 2.0.50727.3603 &#8211; Fatal Execution Engine Error </em> get the patch from Microsoft Connect at the link above. No Ferrets need to be slaughtered.</p>
<p>2. The unrelated problem of Intellisense disappearing from XAML files is caused by installing a Windows SDK after (on top of) Visual Studio 2008. This overwrites the registry key VS uses to locate the XAML Intellisense file. To fix that, run a Repair on Visual Studio 2008 or, if you&#8217;re feeling brave, hack the registry.</p>
<p><strong>So What Happened To You ?</strong></p>
<p>Sick of having no Intellisense in XAML I Googled the registry hack. At the same time I did a <em>&#8216;Close All But Me&#8217; </em>in Visual Studio on a XAML file then closed Visual Studio. I then restarted Visual Studio  to allow the registry hack to take effect, whereupon it did the Chesire Cat on me. It was simply a malevolent coincidence&#8230;perhaps a warning never to do a registry hack when a more polite known fix exists <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  (In this case the Visual Studio Repair.</p>
<p><strong>Hey Bruce</strong>, chuck us another Ferret will ya ?</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/910/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/910/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/910/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=910&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/11/05/visual-studio-2008-disappears-from-screen-when-loading-solution-or-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF Setting Default Sort Order For Datagrid Without Using A Static Resource</title>
		<link>http://waxtadpole.wordpress.com/2009/11/04/wpf-setting-default-sort-order-for-datagrid-without-using-a-static-resource/</link>
		<comments>http://waxtadpole.wordpress.com/2009/11/04/wpf-setting-default-sort-order-for-datagrid-without-using-a-static-resource/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 11:44:10 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Data Sources]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[CollectionViewSource]]></category>
		<category><![CDATA[WPF Toolkit]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=890</guid>
		<description><![CDATA[For this you need a CollectionViewSource and bind the DataGrid ItemsSource to the View property of the CollectionViewSource.
The Basic Wire-Up
Andrea Boschin on Silverlight PlayGround demonstrates the basic wiring for Binding the DataGrid ItemsSource to the CollectionViewSource. Andrea is using MVVM and hence the CollectionViewSource is a property in his ViewModel class. I&#8217;ve excerpted it here:
Public [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=890&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For this you need a <em>CollectionViewSource</em> and bind the DataGrid ItemsSource to the <em>View</em> property of the CollectionViewSource.</p>
<p><strong>The Basic Wire-Up</strong><br />
<a href="http://www.silverlightplayground.org/post/2009/07/18/Use-CollectionViewSource-effectively-in-MVVM-applications.aspx">Andrea Boschin on Silverlight PlayGround</a> demonstrates the basic wiring for Binding the DataGrid ItemsSource to the CollectionViewSource. Andrea is using MVVM and hence the CollectionViewSource is a property in his ViewModel class. I&#8217;ve excerpted it here:</p>
<p><code>Public Class SomeViewModel</p>
<p>// The View of this cvs will get bound to a datagrid<br />
Public CollectionViewSource People { get; set; }   </p>
<p>// The actual data that the cvs will construct its view out of<br />
protected ObservableCollection(Of People) PeopleInternal  { get; set; }<br />
}<br />
} //end class</code></p>
<p>In XAML, bind the DataGrid to the View of the People CollectionViewSource:</p>
<p><code>wpftoolkit:DataGrid ItemsSource="{Binding People.View}"<br />
wpftoolkit:DataGrid.Columns<br />
                wpftoolkit:DataGridTextColumn Header="Name"<br />
                                       MinWidth="120" Binding="{Binding Path=Name, Mode=TwoWay}" /<br />
                wpftoolkit:DataGridTextColumn Header="Age"<br />
                                       Width="auto" Binding="{Binding Path=Age, Mode=TwoWay}" /<br />
            /dg:DataGrid.Columns<br />
/wpftoolkit:DataGrid</code></p>
<p>Taking over from where Andrea left off,  when the ObservableCollection is set, we initialise the CollectionViewSource:</p>
<p><code><br />
protected ObservableCollection(Of People) PeopleInternal<br />
{ get {return _peopleInternal };<br />
   set;<br />
   {<br />
          _peopleInternal = value<br />
          People.Source = _peopleInternal<br />
   }<br />
}</code></p>
<p><strong>Setting Default Sort Order</strong><br />
In order to establish the default Sort Order for the Datagrid, add a <em>SortDescription</em> to the CollectionViewSource that the DataGrid is bound to. This creates the required view.</p>
<p>Let&#8217;s say we wanted our Datagrid to have a sort order of &#8216;Name&#8217;, assuming &#8216;Name&#8217; is a field on the <em>People </em>class.</p>
<p><code><br />
protected ObservableCollection(Of People) PeopleInternal<br />
{ get {return _peopleInternal };<br />
   set;<br />
   {<br />
          _peopleInternal = value<br />
          People.Source = _peopleInternal<br />
          // Setting Sort Order for People<br />
          // Sort by Name field<br />
          People.SortDescriptions.Clear()<br />
          SortDescription sd = new SortDescription("Name", ListSortOrder.Ascending)<br />
          People.SortDescriptions.Add(sd)<br />
   }<br />
}</code></p>
<p>So, every time PeopleInternal is updated, the CollectionViewSource creates a view on PeopleInternal which is sorted by Name. This is held in People.View. Because the DataGrid is bound to this View the data in it is always sorted by name when the ItemsSource (the ObservableCollection(Of People) is initialised</p>
<p>This works around the behaviour in the WPF Toolkit DataGrid where all <a href="http://www.codeplex.com/wpf/Thread/View.aspx?ThreadId=41312">SortDescriptions for the DataGrid are lost when the ItemsSource is initialised </a></p>
<p>Of course, users will still be able to click on Column Headers and sort at any time on any other column they want to.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/890/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/890/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/890/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=890&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/11/04/wpf-setting-default-sort-order-for-datagrid-without-using-a-static-resource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>Over-Complexifying WPF Applications using Prism</title>
		<link>http://waxtadpole.wordpress.com/2009/10/27/over-complexifying-wpf-applications-using-prism/</link>
		<comments>http://waxtadpole.wordpress.com/2009/10/27/over-complexifying-wpf-applications-using-prism/#comments</comments>
		<pubDate>Tue, 27 Oct 2009 05:22:03 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[BabelFish]]></category>
		<category><![CDATA[Complexity]]></category>
		<category><![CDATA[Prism]]></category>
		<category><![CDATA[Refactoring]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=872</guid>
		<description><![CDATA[For those getting started in WPF I recommend the WPF Boot Camp 2008 videos. Make sure you clink on the extended list of links.
An unexpected highlight was Glenn Block of Microsoft Patterns and Practices talking about Prism, the Composite Application Block for WPF. While valiantly attempting to explain Prism to a beginner audience in WPF [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=872&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>For those <strong>getting started in WPF</strong> I recommend the <a href="http://archive.visitmix.com/University/wpf/bc08/Default.aspx">WPF Boot Camp 2008 </a>videos. Make sure you clink on the <a href="http://archive.visitmix.com/University/wpf/bc08/links.htm">extended list of links</a>.</p>
<p>An unexpected highlight was <a href="http://blogs.msdn.com/gblock/">Glenn Block</a> of <a href="http://msdn.microsoft.com/en-us/practices/default.aspx">Microsoft Patterns and Practices </a>talking about <a href="http://www.codeplex.com/CompositeWPF">Prism, the Composite Application Block for WPF</a>. While <a href="http://mschnlnine.vo.llnwd.net/d1/mix/6/2/5/QAWithArchitects_2MB_mix.wmv">valiantly attempting to explain Prism</a> to a beginner audience in WPF without assuming prior knowledge of Dependency Injection, Glenn tells us:</p>
<blockquote><p>There are things we can do to avoid over-complexifying an application beyond its natural complexity</p></blockquote>
<p>I had trouble understanding this so I used <a href="http://au.babelfish.yahoo.com/">Babelfish</a> to Refactor it into Portuguese, from there into French, from there into German, from there into Greek and than back into English:</p>
<blockquote><p>It exists things that we can make avoid a sobre-complexifying application apart from their natural complexity</p></blockquote>
<p>That was a little better, but for added clarity I performed a second-phase refactoring, repeating the previous steps:</p>
<blockquote><p>It exists the things that a application sobre-complexifying omitted their natural complexity you avoid this they can it can</p></blockquote>
<p>If you have any further questions, please ping the Microsoft Patterns and Practices Team.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/872/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/872/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/872/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=872&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/10/27/over-complexifying-wpf-applications-using-prism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://mschnlnine.vo.llnwd.net/d1/mix/6/2/5/QAWithArchitects_2MB_mix.wmv" length="105640821" type="video/x-ms-wmv" />
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>VB.NET &#8216;Type or Namespace cannot be found.&#8217; after converting VS 2005 projects into VS 2008</title>
		<link>http://waxtadpole.wordpress.com/2009/10/23/vb-net-type-or-namespace-cannot-be-found-after-converting-vs-2005-projects-into-vs-2008/</link>
		<comments>http://waxtadpole.wordpress.com/2009/10/23/vb-net-type-or-namespace-cannot-be-found-after-converting-vs-2005-projects-into-vs-2008/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 12:33:17 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Usings]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=855</guid>
		<description><![CDATA[I am converting some VB.NET projects from VS 2005 into VS 2008. I had converted the projects &#8216;Animals&#8217; and &#8216;Food&#8217;, put them into a Solution, Zoo.sln, added a Project Reference for Food into the Animals project and compiled the Solution which duly compiled and ran.
Visual Studio 2008 Conversion Report Ambiguous
But, examining the Conversion Report for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=855&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I am converting some VB.NET projects from VS 2005 into VS 2008. I had converted the projects <em>&#8216;Animals&#8217; </em>and <em>&#8216;Food&#8217;</em>, put them into a Solution, <em>Zoo.sln</em>, added a Project Reference for Food into the Animals project and compiled the Solution which duly compiled and ran.</p>
<p><strong>Visual Studio 2008 Conversion Report Ambiguous</strong><br />
But, examining the Conversion Report for &#8216;Food&#8217;, I noticed that only the Food.vbproj file was marked as converted. The summary at the end of the log said: </p>
<blockquote><p>Converted: 1 file.<br />
Not Converted: 72 files.</p></blockquote>
<p>This made me worried. Why were there 72 files Not Converted ? Had I actually converted Food properly ? Angst got the better of me, so I Unloaded and Removed <em>Food</em> from <em>Zoo.sln</em>, retrieved the source again from Visual Source Safe and reconverted the Project.</p>
<p>I got the same result: 1 file converted (just the vbproj) and 72 files with no status next to them (but no errors either) and a count of 72 &#8216;Not Converted&#8217;.</p>
<p>I Googled here and there and eventually found <a href="http://www.eggheadcafe.com/community/aspnet/7/10032073/cheers.aspx">a forum post by the knowledgable Peter Bromberg </a>which said that Class files (.vb and .cs) will not by touched by the VS 2005 to VS 2008 Conversion. That put me at ease. So then I re-added <em>Food</em> to <em>Zoo.sln</em>, added the Project Reference into Animals as before and recompiled.</p>
<p>This time <strong>102 errors</strong>: Horrific memories of school examinations covered in red pen filled my mind.</p>
<p>All the errors said the same thing: &#8216;Type <em>or Namespace xyz cannot be found. (Are you missing an Imports or Assembly Reference) ?</em>&#8216; All the errors were in <em>&#8216;Anmals&#8217;</em> referring to unknown types which I knew existed in &#8216;<em>Food&#8217;.</em></p>
<p>Well, I checked the Project Properties for <em>&#8216;Animals&#8217; </em>and the Reference to <em>Food </em>ws there and it was to the correct Food.dll. I removed the reference, recompiled <em>Food</em> and re-added the Reference. Still 102 errors. Things hadn&#8217;t looked this grim since the days I flunked MacroEconomics 2A with a score so low it had to be examined through a microscope.</p>
<p><strong>Prodding The Corpse</strong></p>
<p>Here was a typical line returning two unknown type errors on MonkeyDrink:<br />
<code>Dim fermentedCoconut As MonkeyDrink = New MonkeyDrink() </code></p>
<p>As an experiment I tried the following:<br />
<code>Dim fermentedCoconut As Food.MonkeyDrink = New Food.MonkeyDrink() </code></p>
<p>To my amazement, Food.MonkeyDrink appeared in Intellisense and resolved to a known type, reducing my error count. So Animals obviously had a valid Reference to Food. Why then the compile error ?</p>
<p>Now you&#8217;re probably thinking <em>&#8216;the dolt has left out his Import statements in the class files&#8217; </em>but remember these projects were <em>converted</em> &#8211; they never had Imports statements in them in the first place, yet <em>Animals</em> had always compiled with <em>Food</em> before. WHY was it chucking a spaz now ? The pain, the pain, the journey of pain&#8230;</p>
<p><strong>Unknown Feature #999</strong></p>
<p>Checking again the References Tab in the Property Page for the Animals Project, I clicked on Food in the References list then scrolled further down and <strong>noticed for the first time </strong>a pick list of namespaces from all the Referenced projects: Lo and Behold, Food was not selected.  Once I selected Food (thus telling the compiler to Import all the Namespaces from Food) and recompiled, my errors vanished with the silken ease of Master Ninjas after a successful assassination.</p>
<p>The miraculous feature I had discovered is the Visual Studio <strong>Imported Namespaces List</strong> which MSDN beautifully describes <a href="http://msdn.microsoft.com/en-us/library/3w4tctcf.aspx">here</a></p>
<p>The Imported Namespaces List is only available in VB Projects (not C#), that&#8217;s why I had never seen it before.</p>
<p><strong>So Now I Know</strong></p>
<p>If your Types cannot be found in your VB.NET project but you know the containing project is referenced, or maybe you&#8217;re wondering why your Class files have absolutely NO Imports statements in them, have a look at the Imported Namespaces List in the Project Designer via Project Properties. It&#8217;s&#8230;.how you say&#8230;verrrrry nice.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/855/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/855/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/855/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/855/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/855/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/855/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/855/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/855/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/855/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/855/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=855&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/10/23/vb-net-type-or-namespace-cannot-be-found-after-converting-vs-2005-projects-into-vs-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>WPF MVVM in VB.NET: Delegating Event Subscriptions for RoutedCommand (or any ICommand) in the ViewModel</title>
		<link>http://waxtadpole.wordpress.com/2009/10/21/wpf-mvvm-in-vb-net-delegating-event-subscriptions-for-routedcommand-or-any-icommand-in-the-viewmodel/</link>
		<comments>http://waxtadpole.wordpress.com/2009/10/21/wpf-mvvm-in-vb-net-delegating-event-subscriptions-for-routedcommand-or-any-icommand-in-the-viewmodel/#comments</comments>
		<pubDate>Wed, 21 Oct 2009 12:14:33 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Event Handlers]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[Brie]]></category>
		<category><![CDATA[MVVM]]></category>
		<category><![CDATA[Things To Do With A Dead Chicken]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=839</guid>
		<description><![CDATA[Just started a new project in WPF. It&#8217;s my first WPF project and the firm&#8217;s first WPF project. Should be lots to blog about. 
Stick One In His Eye
We are using MVVM because the WPF Pantheon (e.g. John Grossman,  Josh Smith and Jason Dolinger) are in agreement that this pattern is eminently suited to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=839&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Just started a new project in WPF. It&#8217;s my first WPF project and the firm&#8217;s first WPF project. Should be lots to blog about. </p>
<p><strong>Stick One In His Eye</strong></p>
<p>We are using <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">MVVM</a> because the WPF Pantheon (e.g. <a href="http://blogs.msdn.com/johngossman/">John Grossman</a>,  <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">Josh Smith</a> and Jason Dolinger) are in agreement that this pattern is eminently suited to WPF. So, yeah, we&#8217;re taking a bit of a <a href="http://www.science.uva.nl/~mes/jargon/v/voodooprogramming.html">Voodoo Architecture</a> approach.</p>
<p><strong>I am writing a Proof Of Concept</strong> using MVVM and found <a href="http://blog.lab49.com/archives/2650">an absolutely brilliant video by Jason Dolinger here which shows a comprehensive refactoring example in MVVM </a>while lucidly explaining the pattern. I was following the vid while coding my Proof Of Concept but got well and truly stuck on the part where Jason delegates (that&#8217;s del-e-<em>GATEs</em> as a verb) event subscriptions for the RoutedCommand in the ViewModel. </p>
<p><strong>The Google To End All Googles</strong></p>
<p><strong>The reason I got stuck</strong> was that the vid is in C#  whereas I am using VB.NET, which is not a problem in myself, but Jason was using C# <a href="http://msdn.microsoft.com/en-us/library/bb882534.aspx">Event Accessors </a>to delegate the Event subscription. I had never heard of Event Accessors, Jason did not say what they were and VB.NET does not have them (at least not by that name). </p>
<p>I commenced a Google and soon saw that all the MSDN WPF examples are in C# only and not in VB.NET. I was looking for something I didn&#8217;t know the name of to do something I didn&#8217;t understand in a language which did not have the construct I needed. I was just about to wave a Dead Chicken at the monitor when, in the end Google did cough up an answer&#8230;in French. <a href="http://french.about.com/library/express/blex_proverb.htm">Impossible n&#8217;est pas français.</a></p>
<p><strong>Here&#8217;s what had me stuck</strong>. What I needed was the VB.NET translation for this code<br />
<code><br />
public event EventHandler CanExecuteChanged<br />
    {<br />
        add { CommandManager.RequerySuggested += value; }<br />
        remove { CommandManager.RequerySuggested -= value; }<br />
    }</code></p>
<p><strong>First I had to figure out what the heck it was doing.</strong> Jason just said <em>&#8216;now we have to wire the ICommand into the WPF Commanding system&#8217;</em> which left me very little the wiser. Well, ladies and gentlemen what you are witnessing above is the use of an Event Accessor to delegate (That&#8217;s del-e-<em>GATE</em> as a verb, not <em>DEL</em>-e-gate as a noun) event subscriptions. </p>
<p>In more detail, the &#8216;add&#8217; Event Accessor is fired when an Event Subscription to CanExecuteChanged occurs. <em>Value</em> contains the Delegate i.e. Event Handler which is subscribing to the Event. Hence, the Event Handler denoted by value is being added to the Event Handler List for the CommandManager RequerySuggested event. This has the effect of wiring the WPF ICommand object that has that event subscription into the WPF Commanding infrastructure, thus allowing that ICommand to take effect.</p>
<p><strong>VB.NET does not have Event Accessors</strong> but it does have a direct equivalent, namely Custom Events. Here&#8217;s the equivalent VB.NET code:</p>
<p><code><br />
Public Custom Event CanExecuteChanged As EventHandler Implements System.Windows.Input.ICommand.CanExecuteChanged<br />
        AddHandler(ByVal value As EventHandler)<br />
             'This is the AddHandler block<br />
                AddHandler CommandManager.RequerySuggested, value<br />
        End AddHandler</p>
<p>        RemoveHandler(ByVal value As EventHandler)<br />
        'This is the RemoveHandler block<br />
                RemoveHandler CommandManager.RequerySuggested, value<br />
        End RemoveHandler<br />
        '<br />
        RaiseEvent(ByVal sender As Object, ByVal e As System.EventArgs)<br />
        'This is the RaiseEvent block<br />
            CommandManager.InvalidateRequerySuggested()<br />
        End RaiseEvent<br />
    End Event</code></p>
<p>You can see its the same thing as a set of C# Event Accessors.</p>
<p>For the above code I am sobbing in helpless gratitude to <strong>binoo</strong>, <em>moderateur</em> of the WPF Forum at Devellopez.Com who posted the above code in this thread, <a href="http://www.developpez.net/forums/d766888/dotnet/general-dotnet/wpf/modele-mvvm-implementation-icommand/">entitled Modèle MVVM &#8211; Implémentation ICommand </a></p>
<p><strong>What Are Custom Events ?</strong></p>
<p>Mesdames and messuirs, you may read about Custom Events <a href="http://www.codeguru.com/vb/gen/vb_general/idelanguage/article.php/c9481/">here.</a> They enable custom handling of <em>AddHandler, RemoveHandler and RaiseEvent </em>calls for any event. </p>
<p>The above code, for example says that when AddHandler is called for a CanExecuteChanged event that the event handler for that event should be added to the RequerySuggested event of the CommandManager. The inverse happens for RemoveHandler and CommandManager.InvalidateRequerySuggested() is called when a RaiseEvent is done on a CanExecuteChanged event.</p>
<p><strong>Further Reading</strong></p>
<p>I will assume that anyone interested in this post knows about MVVM in WPF and why I would be wanting to wire up ICommand objects in the ViewModel, but for those who have heroically read this far without that pre-requisite knowledge, just click on the MVVM link at the start of the article and the one about the MVVM refactoring video.</p>
<p>And to <strong>binoo</strong>, now my favourite <em>moderateur</em> in the world, may your hovercraft be ever full of eels and your Brie only <a href="http://cheesemonger.wordpress.com/2009/10/08/2009-world-cheese-awards-categories-15-16-brie-and-camembert/">Triple Cream.</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/839/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/839/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/839/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/839/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/839/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/839/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/839/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/839/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/839/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/839/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=839&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/10/21/wpf-mvvm-in-vb-net-delegating-event-subscriptions-for-routedcommand-or-any-icommand-in-the-viewmodel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>BTWT Semi-Officially &#8216;Somewhat Funny&#8217;</title>
		<link>http://waxtadpole.wordpress.com/2009/10/14/btwt-semi-officially-somewhat-funny/</link>
		<comments>http://waxtadpole.wordpress.com/2009/10/14/btwt-semi-officially-somewhat-funny/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 12:01:50 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=823</guid>
		<description><![CDATA[Checking referrers to my blog I found that rumbergd in this Yahoo Groups Discussion had found a post I had done on LINQ Context.SubmitChanges to be useful and &#8217;somewhat funny&#8217;, which are my two primary aims for Bite The Wax Tadpole. 
But then again, maybe rumbergd was describing the article that I linked to and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=823&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Checking referrers to my blog I found that rumbergd in <a href="http://tech.groups.yahoo.com/group/CSCI-E237-Fall2009/message/158?threaded=1">this Yahoo Groups Discussion</a> had found a post I had done on LINQ Context.SubmitChanges to be useful and &#8217;somewhat funny&#8217;, which are my two primary aims for Bite The Wax Tadpole. </p>
<p>But then again, maybe rumbergd was describing the article that I <em>linked to</em> and not the article that<em> I </em>actually wrote. Surely not&#8230;blurb&#8230;</p>
<blockquote><p>If anyone interested also interesting post:<br />
http://waxtadpole.wordpress.com/2008/05/08/linq-contextsubmitchanges-does-not-ad\<br />
d-record-to-database/</p>
<p>And the link from it:<br />
http://www.codinghorror.com/blog/archives/001079.html</p>
<p>Main idea &#8211; &#8216;always assume the problem is in your code&#8217; <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> ))<br />
I found that article pretty interesting and somewhat funny.</p></blockquote>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/823/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/823/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/823/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/823/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/823/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/823/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=823&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/10/14/btwt-semi-officially-somewhat-funny/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>DataBinding WinForms CheckedListBox</title>
		<link>http://waxtadpole.wordpress.com/2009/10/12/assigning-custom-class-to-checkedlistbox-datasource/</link>
		<comments>http://waxtadpole.wordpress.com/2009/10/12/assigning-custom-class-to-checkedlistbox-datasource/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 11:48:17 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Data Sources]]></category>
		<category><![CDATA[Winforms]]></category>
		<category><![CDATA[.NET Framework Bugs]]></category>
		<category><![CDATA[CheckedListBox]]></category>
		<category><![CDATA[Undocumented Features]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=781</guid>
		<description><![CDATA[Noting some confusion in the Greater Google on the subject of the CheckedListBox, I want to make it clear that this article is about the WINFORMS CheckedListBox class (System.Windows.Forms.CheckedListBox), NOT the WebForms CheckBoxList class (System.Web.UI.WebControls.CheckBoxList). So back to your Postbacks all you WebForms freaks.
Generating CheckedListBox Text
The CheckedListBox is a ListBox which includes a CheckBox to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=781&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p><strong>Noting some confusion in the Greater Google</strong> on the subject of the <em>CheckedListBox</em>, I want to make it clear that this article is about the <strong>WINFORMS</strong> <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.checkedlistbox.aspx">CheckedListBox</a> class (System.Windows.Forms.CheckedListBox), <em>NOT</em> the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.checkboxlist.aspx">WebForms CheckBoxList</a> class (System.Web.UI.WebControls.CheckBoxList). So back to your Postbacks all you WebForms freaks.</p>
<p><strong>Generating CheckedListBox Text</strong><br />
The CheckedListBox is a ListBox which includes a CheckBox to the left of the display text. The display text is computed using the <em>ToString</em> method of the object in the Items collection of the CheckedListBox.</p>
<p>It is also possible, however, to generate the text in each CheckedListBox entry by associating the CheckedListBox with a DataSource and setting the DisplayMember field of the CheckedListBox.</p>
<p><strong>Microsoft do not encourage the use of CheckedListBox DataSource</strong>. None of the <em>DataSource, DisplayMember or ValueMember </em> members of CheckedListBox appear in the Intellisense for the control or in the Designer Properties Window because Microsoft has added the Browsable=false attribute to these properties. In the MSDN example, programmers are referred directly to the Items collection as the means of wiring up the control:</p>
<p><code>To add objects to the list at run time, assign an array of object references with the AddRange method. The list then displays the default string value for each object. You can add individual items to the list with the Add method.</code></p>
<p><strong>Microsoft MSDN advises users not to use the DataSource member of CheckedListBox</strong> because <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=115199">this control is not intended to be DataBound </a>and unpredictable results can ensue if you use the control in a DataBound way. However the DataSource, ValueMember and DisplayMember members can be used as I discovered from Moz2 in <a href="http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/c34c85d3-a66d-4c7b-97e2-f3fc5369458f/">this MSDN social forum thread</a></p>
<p><strong>Why Would You Bother ?</strong><br />
It&#8217;s a fair question. For me, I needed to produce a Windows Form with identical look and feel to an existing form which utilised a CheckedListBox, but for processing efficiency also required a SelectedValue member. That led me into a fruitful Googling session which I am now sharing with you.</p>
<p><strong>Setting CheckedListBox DataSource</strong><br />
You can set the DataSource to any Collection. But you must set DataSource <em>after</em> DisplayMember is set. Here&#8217;s some VB.NET for your reading pleasure:</p>
<p> <code><br />
    'Event Handler for WebSiteType dropdown selected index changed<br />
    'Update Listed Domains in CheckBox List clbWebDomain based on selected WebSiteType<br />
    Private Sub cboWebSiteType_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboWebSiteType.SelectedIndexChanged<br />
        Me.clbWebDomain.DataSource = Nothing<br />
        Me.clbWebDomain.Items.Clear()<br />
        ...Update Me.WebDomainMappingList...<br />
        Me.clbWebDomain.ValueMember = "DomainCode"<br />
        Me.clbWebDomain.DisplayMember = "URL"<br />
        Me.clbWebDomain.DataSource = Me.WebDomainMappingList<br />
        ...Code to initialise clbWebDomain.Items.....<br />
    End Sub </code></p>
<p>WebDomainMappingList is a GenericList of my Custom Class WebDomainMapping.</p>
<p>Since that WebDomainMapping  Class is only used for temporary processing, I actually implemented it as a <em>Structure</em>. I didn&#8217;t put in a <em>ToString</em> implementation as I wanted it clear via the DisplayMember that I wanted to display the URL property&#8230;and that leads me to my next point, the <em>DisplayMember</em> and <em>ValueMember</em> members <em>must refer to Properties </em>of the Objects/Structures in the Items collection of your CheckedListBox. They <strong>cannot</strong> be mere fields otherwise your CheckedListBox will fill up with garbage. </p>
<p>Therefore, the following will NOT work:</p>
<p><code>Friend Structure WebDomainMapping<br />
    Dim URL As String<br />
    Dim DomainCode As Integer<br />
End Structure</code></p>
<p>Putting an Object/Structure like this into the Items collection of a CheckedListBox and then using the URL property as a DisplayMember will cause the following output to your CheckedListBox for all the entries. This is actually the default <em>ToString() </em>representation of the object in your CheckedListBox Items Collection</p>
<p>Namespace.frmReport+WebDomainMapping<br />
Namespace.frmReport+WebDomainMapping<br />
etc.</p>
<p>An Object/Structure definition like <strong>this will work</strong>. It wlll allow URL to be used as the DisplayMember of the CheckedListBox.</p>
<p><code>Friend Structure WebDomainMapping<br />
    Private _URL As String<br />
    Public Property URL() As String<br />
            Get<br />
                  Return _URL<br />
            End Get<br />
            Set (ByVal value As String)<br />
                  _URL = value<br />
             End Set<br />
    End Property</p>
<p>    Private _DomainCode As Integer<br />
    ...Property Declaration for DomainCode....<br />
End Structure</code></p>
<p><strong>Directly Initialise The Items Collection Too</strong><br />
It is not enough merely to initialise the DataSource member of CheckedListBox. You must also directly initialise the Items Collection if you don&#8217;t do this you will not get anything at all displayed in the CheckedListBox. </p>
<p>Naturally, the Items collection must contain EXACTLY the same Objects as the DataSource.</p>
<p>Remember, true DataBinding as represented by DataSource, DisplayMember and ValueMember is not officially supported for this control, so utilising these members may not provide the functionality you would expect or may not work at all. For example, here the Items Collection is not automatically populated by assigning the DataSource. What you can do, as I have done, is patch together an implementation or approximation of DataBinding for CheckedListBox. The functionality, or at least most of it, is there because it is inherited from Base Controls. </p>
<p><strong>Final Caveats</strong><br />
The partial implementation of DataBinding in CheckedListBox and hence its flaky functionality is recognised by Microsoft as a bug (see preceeding links), but there is no guarantee this will be fixed to support full DataBinding. Microsoft may decide to chop DataSource from CheckedListBox entirely. I used the above workaround in version 2.0 of the Framework. Who knows, it might be gone or not work at all in later versions.</p>
<p><strong>Why DataBinding Can Only Be To Properties and not Fields</strong><br />
<a href="http://www.nikhilk.net/About.aspx">Nikhail Koltari </a> who is a Software Architect at Microsoft, explains some of the reasons why <a href="http://www.nikhilk.net/DataBindingToPublicFields.aspx">here.</a></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/781/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/781/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/781/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/781/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/781/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/781/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/781/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/781/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/781/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/781/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=781&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/10/12/assigning-custom-class-to-checkedlistbox-datasource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>Incorrect Syntax Near &#8220;.&#8221; during DataAdapter.Fill</title>
		<link>http://waxtadpole.wordpress.com/2009/09/24/incorrect-syntax-near-during-dataadapter-fill/</link>
		<comments>http://waxtadpole.wordpress.com/2009/09/24/incorrect-syntax-near-during-dataadapter-fill/#comments</comments>
		<pubDate>Thu, 24 Sep 2009 05:52:33 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[Giblets]]></category>
		<category><![CDATA[Reptilian Brain Stem]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=766</guid>
		<description><![CDATA[Warning: Some of the links in this post may distress Cat Fanciers.
What  Have I Done To Deserve This ?
Incorrect Syntax near &#8220;.&#8221; on a DataAdapter Fill means the SQL for your Select Command in your SQLCommand object has a syntax error in it&#8230;same as what I did. The bit in the double quotes after [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=766&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Warning: Some of the links in this post may distress Cat Fanciers.</p>
<p><strong>What  Have I Done To Deserve This ?</strong><br />
Incorrect Syntax near &#8220;.&#8221; on a DataAdapter Fill means the SQL for your Select Command in your SQLCommand object has a syntax error in it&#8230;same as what I did. The bit in the double quotes after &#8216;Near&#8217; shows what caused the SQL Parser to <a href="http://www.adammessinger.com/2005/03/28/fancy-feast-choke">choke on its own giblets</a>. Hey, look on the bright side. Mine happened while I was doing a practical test during a job interview. </p>
<p>Due to its initial obscurity and brevity, this error caused stage one panic (<a href="http://meghitchcock.blogspot.com/2009/09/brain-puree-leaking-out-my-nostrils.html">Brain leaking out of nostil,</a> inflamed Hello Kitty, gargantuan screaming noise from reptilian brain stem), but a few Googles put me right.</p>
<p><strong>How To Fix It</strong></p>
<p>Well, correct the syntax error in the SQL obviously.</p>
<p>Mine came about through a bad concatenation. Like so:</p>
<p><code> ' Create a SqlConnection to the Northwind database.<br />
        Using connection As SqlConnection = New SqlConnection( _<br />
           connectionString)</p>
<p>            ' Create a SqlDataAdapter for the Suppliers table.<br />
            Dim suppliersAdapter As SqlDataAdapter = _<br />
               New SqlDataAdapter()</p>
<p>            ' A table mapping names the DataTable.<br />
            suppliersAdapter.TableMappings.Add("Table", "Suppliers")</p>
<p>            ' Open the connection.<br />
            connection.Open()<br />
            Console.WriteLine("The SqlConnection is open.")</p>
<p><strong>            'Bad concatenation here<br />
           Dim commandString As String = _<br />
              "SELECT SupplierID, CompanyName FROM dbo.Suppliers" &amp; _<br />
              "WHERE supplierID &gt; 100" </strong></p>
<p>            ' Create a SqlCommand to retrieve Suppliers data.<br />
            Dim suppliersCommand As SqlCommand = New SqlCommand( _<br />
               commandString, connection)<br />
            suppliersCommand.CommandType = CommandType.Text</p>
<p>            ' Set the SqlDataAdapter's SelectCommand.<br />
            suppliersAdapter.SelectCommand = suppliersCommand</p>
<p>            ' Fill the DataSet.<br />
            Dim dataSet As DataSet = New DataSet("Suppliers")<br />
            <strong>'Incorrect Syntax Crash Here<br />
            suppliersAdapter.Fill(dataSet)</strong></code></p>
<p><strong>You Bad Concatenation, You</strong></p>
<p>As you can see above, there is no space between my WHERE clause and the SELECT clause.</p>
<p>The resulting command was thus:<br />
&#8220;SELECT SupplierID, CompanyName FROM dbo.SuppliersWHERE supplierID &gt; 100&#8243; </p>
<p>There is no table called dbo.SuppliersWHERE and no where clause in the query at all.<br />
Fixing it entailed simply inserting a space at the end of the SELECT clause.</p>
<p>           Dim commandString As String = _<br />
             <strong> &#8220;SELECT SupplierID, CompanyName FROM dbo.Suppliers &#8220;</strong> &amp; _<br />
              &#8220;WHERE supplierID &gt; 100&#8243; </p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/766/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/766/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/766/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/766/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/766/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/766/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/766/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/766/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/766/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/766/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=766&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/09/24/incorrect-syntax-near-during-dataadapter-fill/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>Powershell: Update Active Directory Permissions</title>
		<link>http://waxtadpole.wordpress.com/2009/09/01/powershell-update-active-directory-permissions/</link>
		<comments>http://waxtadpole.wordpress.com/2009/09/01/powershell-update-active-directory-permissions/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 04:15:58 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Powershell]]></category>
		<category><![CDATA[Guts]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=747</guid>
		<description><![CDATA[If you&#8217;re new to manipulating Active Directory in Powershell and you want to answer a question like &#8216;How do I give domain user prod\bruce write access to AD object LDAP://adserver.prod.com/cn=MegaServer, cn=Computers, cn=prod, cn=net&#8217;, then this brilliant article by Richard Siddaway &#8216;Windows Server 2008 Protection from Accidental Deletion&#8217; is just what you need.
I&#8217;m just linking it [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=747&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>If you&#8217;re new to manipulating Active Directory in Powershell and you want to answer a question like <em>&#8216;How do I give domain user prod\bruce write access to AD object LDAP://adserver.prod.com/cn=MegaServer, cn=Computers, cn=prod, cn=net&#8217;</em>, then this brilliant article by Richard Siddaway <a href="http://blogs.technet.com/industry_insiders/pages/windows-server-2008-protection-from-accidental-deletion.aspx">&#8216;Windows Server 2008 Protection from Accidental Deletion&#8217;</a> is just what you need.</p>
<p>I&#8217;m just linking it here because its title makes it a bit difficult to find and it deserves more exposure.</p>
<p><strong>Here&#8217;s the guts of it</strong><br />
<code><br />
$ou = [ADSI]"LDAP://ou=Thunderbirds,dc=starking,dc=org"</p>
<p>$sec = $ou.psbase.ObjectSecurity</p>
<p>## set the rights and control type</p>
<p>$act = [System.Security.AccessControl.AccessControlType]::Deny</p>
<p>$adrights = [System.DirectoryServices.ActiveDirectoryRights]::Delete</p>
<p>$adrights2 = [System.DirectoryServices.ActiveDirectoryRights]::DeleteTree</p>
<p>## who does this apply to</p>
<p>$who = New-Object -TypeName System.Security.Principal.NTAccount -ArgumentList "", "prod\bruce"</p>
<p># stop delete</p>
<p>$newrule1 = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $who, $adrights, $act</p>
<p>$sec.AddAccessRule($newrule1)</p>
<p>$ou.psbase.CommitChanges()</p>
<p># stop deletetree</p>
<p>$newrule2 = New-Object -TypeName System.DirectoryServices.ActiveDirectoryAccessRule -ArgumentList $who, $adrights2, $act</p>
<p>$sec.AddAccessRule($newrule2)</p>
<p>$ou.psbase.CommitChanges()</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/747/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/747/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/747/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/747/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/747/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/747/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/747/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/747/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/747/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/747/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=747&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/09/01/powershell-update-active-directory-permissions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
		<item>
		<title>Powershell: Updating a MultiValued Active Directory Property</title>
		<link>http://waxtadpole.wordpress.com/2009/08/30/powershell-updating-a-multivalued-active-directory-property/</link>
		<comments>http://waxtadpole.wordpress.com/2009/08/30/powershell-updating-a-multivalued-active-directory-property/#comments</comments>
		<pubDate>Sun, 30 Aug 2009 12:05:22 +0000</pubDate>
		<dc:creator>baraholka1</dc:creator>
				<category><![CDATA[Active Directory]]></category>
		<category><![CDATA[Powershell]]></category>

		<guid isPermaLink="false">http://waxtadpole.wordpress.com/?p=731</guid>
		<description><![CDATA[This one took me a little big of digging around for because the typical scenario for updating a multi-valued AD property is that a SysAdmin is adding a new email address to a list of email addresses in some property i.e. an Append Operation.
Whereas, what I wanted to do was overwrite one of the values [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=731&subd=waxtadpole&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>This one took me a little big of digging around for because the typical scenario for updating a multi-valued AD property is that a SysAdmin is adding a new email address to a list of email addresses in some property i.e. an <em>Append </em>Operation.</p>
<p>Whereas, what <em>I</em> wanted to do was overwrite one of the values in a multivalued property with an updated value i.e. an<em> Update</em> operation.</p>
<p>First thing you need to know is to <strong>use PutEx </strong>instead of Put when updating Multi-valued properties. Most simple examples on the Greater Google are about updating single-valued properties &#8211; integers or strings or whatever. These are updated using Put. MultiValued properties use PutEx.</p>
<p>Second thing is that you need to use the methods for the correct AD Provider and not to mix them up. Where you are using PutEx, then you commit that change to the actual AD database server <strong>using SetInfo() </strong>instead of CommitChanges(). I&#8217;ll get some more detail on that in here before long.</p>
<p>Next thing you need to realise is that the type of a MultiValued AD property in .NET is <em>PropertyValueCollection</em>, but that the PutEx method takes an Array Of Object (i.e. Object[]) as its parameter. You have to convert from <em>PropertyValueCollection</em> to <em>Array.</em> Fortunately that&#8217;s easy.</p>
<p>Finally, and obviously, you need to make sure that <strong>the account you are using to bind </strong>to Active Directory <strong>has Write Privileges to the entry you&#8217;re trying to update</strong>, otherwise you will get AD&#8217;s equivalent of the Blue Screen Of Death, <em>&#8216;General Access Denied Error&#8217;.</em></p>
<p>To get started, <a href="http://www.microsoft.com/technet/scriptcenter/resources/qanda/may05/hey0510.mspx">here&#8217;s a great page on updating a MuliValued AD property with an Append</a> from The Scripting Guy on TechNet. Digest this and you&#8217;ll know most of what you need to know.</p>
<p><strong>Now, here&#8217;s how I did my Update operation on the Multivalued property.</strong> Probably the code is a bit clunky but it works and we can refine it a bit later. Hopefully the comments in the code provide enough explanation.</p>
<p>The objective is to search for the key &#8216;<em>Fruit&#8217;</em> in the MultiValued property &#8216;keywords&#8217; and update its value from <em>&#8216;Banana&#8217; </em>to <em>&#8216;Kumquat&#8217;</em></p>
<p># The account Place\myaccount must have write privs to the LDAP Path specified.<br />
$entry = new-object DirectoryServices.DirectoryEntry (“LDAP://MyLDAPServer/dc=place, dc=room, dc=net”, “place\myaccount”, “mypassword”)<br />
$keywords = $entry.Keywords<br />
# Convert keywords propertyValueCollection to a fixed-length array<br />
# because the DirectoryEntry update function takes an Array, not<br />
# a PropertyValueCollection as a parameter<br />
$length = $keywords.Count<br />
[Array]$keywordsArray = 1..$length<br />
# This CopyTo moves the propertyValueCollection to an array.<br />
$entry.Keywords.CopyTo($keywordsArray, 0)</p>
<p># Search for &#8216;Fruit&#8217; entry in keywords<br />
$foundKey = $false<br />
for($i=0; $i -lt $keywordsArray.Length; $i++)<br />
{<br />
	$keyword = $keywordsArray[$i]<br />
	Write-Debug &#8220;$keyword&#8221;<br />
	if ($keywordsArray[$i].ToLower().Contains(&#8220;fruit&#8221;))<br />
	{<br />
		$foundKey = $true<br />
		# Retain index of Fruit property so it can be updated below<br />
		$fruitIdx = $i<br />
		break<br />
	}<br />
}</p>
<p>#Check if we found Fruit Entry<br />
if ($foundFruit -eq $false)<br />
{<br />
	throw (&#8220;Did not find Fruit keyword in Active Directory object&#8221;)<br />
}			</p>
<p># Extract Fruit Value from KeywordValue pair<br />
# Fruit entry is &#8220;Fruit:<br />
$fruitParts = $keyword.Split(&#8220;:&#8221;)<br />
Write-Debug &#8220;Fruit is $fruitParts[1]&#8220;</p>
<p># Change &#8220;Fruit&#8221; key. Update the value to &#8216;Kumquat&#8217;<br />
$newFruitEntry = $fruitParts[0] + &#8220;Kumquat&#8221;<br />
Write-Debug &#8220;Updated keyword entry is $newFruitEntry&#8221;<br />
$keywordsArray[$FruitIdx] = $newFruitKey					</p>
<p># Update DirectoryEntry<br />
# PutEx, instead of Put required for multivalued AD entries such as keyword<br />
# First parameter denotes type of PutEx i.e. Append, Update or Delete In our case its an Update.<br />
$ADS_PROPERTY_UPDATE = 2<br />
$entry.PutEx($ADS_PROPERTY_UPDATE, &#8220;Keywords&#8221;, $keywordsArray)<br />
Write-Debug &#8220;committing AD Change&#8230;&#8221;<br />
# Commit to AD database on server<br />
$entry.SetInfo()<br />
Write-Debug &#8220;committed&#8221;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/waxtadpole.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/waxtadpole.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/waxtadpole.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/waxtadpole.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/waxtadpole.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/waxtadpole.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/waxtadpole.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/waxtadpole.wordpress.com/731/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/waxtadpole.wordpress.com/731/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/waxtadpole.wordpress.com/731/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=waxtadpole.wordpress.com&blog=3595697&post=731&subd=waxtadpole&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://waxtadpole.wordpress.com/2009/08/30/powershell-updating-a-multivalued-active-directory-property/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4bda19dc0c658eee779a12d54e16d6a1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">baraholka</media:title>
		</media:content>
	</item>
	</channel>
</rss>