<?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>MS Programmer</title>
	<atom:link href="http://www.msprogrammer.com/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.msprogrammer.com</link>
	<description>Developing on the MS platform</description>
	<lastBuildDate>Thu, 04 Feb 2010 15:14:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Good MOSS 2007 / WSS 3.0 Installation Guides</title>
		<link>http://www.msprogrammer.com/index.php/2010/01/11/good-moss-2007-wss-30-installation-guides/</link>
		<comments>http://www.msprogrammer.com/index.php/2010/01/11/good-moss-2007-wss-30-installation-guides/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 20:12:39 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[MOSS 2007]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2010/01/11/good-moss-2007-wss-30-installation-guides/</guid>
		<description><![CDATA[Two very good articles on best practices for MOSS 2007 / WSS 3.0 installation: MOSS 2007 Installation http://www.sharepointforum.se/en-US/Wiki/Installation%20MOSS%202007.aspx WSS 3.0 Installation http://www.sharepointforum.se/en-US/Wiki/Installation%20WSS%203.0.aspx]]></description>
			<content:encoded><![CDATA[<p>Two very good articles on best practices for MOSS 2007 / WSS 3.0 installation: </p>
<p>MOSS 2007 Installation   <br /><a href="http://www.sharepointforum.se/en-US/Wiki/Installation%20MOSS%202007.aspx">http://www.sharepointforum.se/en-US/Wiki/Installation%20MOSS%202007.aspx</a></p>
<p>WSS 3.0 Installation   <br /><a href="http://www.sharepointforum.se/en-US/Wiki/Installation%20WSS%203.0.aspx">http://www.sharepointforum.se/en-US/Wiki/Installation%20WSS%203.0.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2010/01/11/good-moss-2007-wss-30-installation-guides/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>SharePoint: Cannot delete master page</title>
		<link>http://www.msprogrammer.com/index.php/2010/01/10/sharepoint-cannot-delete-master-page/</link>
		<comments>http://www.msprogrammer.com/index.php/2010/01/10/sharepoint-cannot-delete-master-page/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 17:42:23 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2010/01/10/sharepoint-cannot-delete-master-page/</guid>
		<description><![CDATA[A known issue exists with SharePoint / MOSS 2007 that produces the following error when attempting to delete a master page form the master page gallery: This item cannot be deleted because it is still referenced by other pages. &#160; &#160; This error might be expected if the master page was still in use, but [...]]]></description>
			<content:encoded><![CDATA[<p>A known issue exists with SharePoint / MOSS 2007 that produces the following error when attempting to delete a master page form the master page gallery:    </p>
<blockquote><p><font size="2" face="Courier New">This item cannot be deleted because it is still referenced by other pages.</font></p>
<p>&#160;</p>
</blockquote>
<p>&#160;</p>
<p>This error might be expected if the master page was still in use, but the error is shown regardless if other pages still reference the master page or not.</p>
<p>A Microsoft Knowledge Base article exists (<a title="http://support.microsoft.com/?kbid=926812" href="http://support.microsoft.com/?kbid=926812">http://support.microsoft.com/?kbid=926812</a>) which suggests setting the master page to a hidden state, but sometimes that isn’t enough. There are times when it is more than just a clean up issue, often it really is necessary to completely remove the file.</p>
<p>To completely delete the master page, perform the following steps:</p>
<ol>
<li>Navigate to the Master Page Gallery page from the Site Settings page. </li>
<li>Select ‘New’ | ‘Folder’ from the menu bar. </li>
<li>Create the folder with a temporary name such as DeleteMe. </li>
<li>Open the site with SharePoint Designer and navigate to the ‘_catalogs\masterpage’ folder.</li>
<li>Drag and drop the master page to delete into the temporary folder created in the above steps.</li>
<li>Close SharePoint Designer.</li>
<li>Return to the Master Page Gallery and delete the temporary folder.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2010/01/10/sharepoint-cannot-delete-master-page/feed/</wfw:commentRss>
		<slash:comments>39</slash:comments>
		</item>
		<item>
		<title>Error opening SharePoint list in Windows Explorer on Windows Server 2008</title>
		<link>http://www.msprogrammer.com/index.php/2010/01/10/error-opening-sharepoint-list-in-windows-explorer-on-windows-server-2008/</link>
		<comments>http://www.msprogrammer.com/index.php/2010/01/10/error-opening-sharepoint-list-in-windows-explorer-on-windows-server-2008/#comments</comments>
		<pubDate>Sun, 10 Jan 2010 06:24:38 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2010/01/10/error-opening-sharepoint-list-in-windows-explorer-on-windows-server-2008/</guid>
		<description><![CDATA[Attempting to open a SharePoint document library in Windows Explorer view by choosing&#160; ‘Actions’ &#124; ‘Open with Windows Explorer’ on a Windows Server 2008 machine generates the following error: Your client does not support opening this list with Windows Explorer. &#160; This is because the ‘Web Client’ service is required, but not installed on Windows [...]]]></description>
			<content:encoded><![CDATA[<p>Attempting to open a SharePoint document library in Windows Explorer view by choosing&#160; ‘Actions’ | ‘Open with Windows Explorer’ on a Windows Server 2008 machine generates the following error:    </p>
<blockquote><p><font size="2" face="Courier New">Your client does not support opening this list with Windows Explorer.       </p>
<p></font></p>
</blockquote>
<p>&#160;</p>
<p>This is because the ‘Web Client’ service is required, but not installed on Windows Server 2008 by default. The service can be installed as a part of the ‘Desktop Experience’ Windows feature. To install the ‘Desktop Experience’ Windows feature perform the following steps:</p>
<ol>
<li>Open ‘Server Manager’ from Administrator Tools. </li>
<li>Highlight the ‘Features’ node under Server Manager. </li>
<li>Click the ‘Add Features’ link on the right-hand side of the screen. </li>
<li>Check ‘Desktop Experience’.</li>
<li>Click ‘Next’.</li>
<li>Click ‘Install’.</li>
<li>You will be prompted to restart the server.</li>
</ol>
<p>&#160;</p>
<p></p>
<p>Thank you to Tihomir Ignatov for his <a href="http://tihomirignatov.blogspot.com/2009/08/sharepoint-error-message-your-client.html">post</a> on this error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2010/01/10/error-opening-sharepoint-list-in-windows-explorer-on-windows-server-2008/feed/</wfw:commentRss>
		<slash:comments>191</slash:comments>
		</item>
		<item>
		<title>A Regular Expression (RegEx) to parse city, state and zip code for .NET</title>
		<link>http://www.msprogrammer.com/index.php/2009/12/27/a-regular-expression-regex-to-parse-city-state-and-zip-code-for-net/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/12/27/a-regular-expression-regex-to-parse-city-state-and-zip-code-for-net/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 23:54:04 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[.NET Development]]></category>
		<category><![CDATA[RegEx]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/12/27/a-regular-expression-regex-to-parse-city-state-and-zip-code-for-net/</guid>
		<description><![CDATA[Requirement: Develop a Regular Expression to parse a single line of text considering any of the following combinations of City, State, and Zip Code valid: City State City&#60;space&#62;Name State City, State City&#60;space&#62;Name, State City State Zip City&#60;space&#62;Name State Zip City, State Zip City&#60;space&#62;Name, State Zip Zip Regular Expressions can be very powerful, but also can [...]]]></description>
			<content:encoded><![CDATA[<p>Requirement: Develop a Regular Expression to parse a single line of text considering any of the following combinations of City, State, and Zip Code valid:</p>
<ul>
<li>City State</li>
<li>City&lt;space&gt;Name State</li>
<li>City, State</li>
<li>City&lt;space&gt;Name, State</li>
<li>City State Zip</li>
<li>City&lt;space&gt;Name State Zip</li>
<li>City, State Zip</li>
<li>City&lt;space&gt;Name, State Zip</li>
<li>Zip</li>
</ul>
<p>Regular Expressions can be very powerful, but also can be a bit hard to develop and read. I would recommend using a good RegEx editor to help you build and test your expressions. Also, make sure to comment your expressions to assist in future maintenance and debugging.</p>
<p>After trying out a few RegEx tools, I recommend using <a href="http://www.ultrapico.com/Expresso.htm">Expresso</a> which is available on the <a href="http://www.ultrapico.com">Ultrapico</a> web site. The tool includes a 60 day trial period, and at the time of writing this article, the actual registration for the tool is also free.</p>
<p>To accomplish the above requirement, I found that using named groups and multiple or conditions (‘|’) was the best way to handle all the different combinations of City, State, and Zip Code I needed to support. This made it easy to allow for commas or the lack of commas and different spacing in the input text as well.</p>
<p>Using Expresso, I came up with the following Regular Expression:</p>
<p><span style="color: #993300; font-size: 8pt;">(updated 2/4/2010 to allow for &#8216;.&#8217; (period) and &#8216;-&#8217; (dash) in City names)</span></p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #008000">#Parse address line into named groups (City, State, Zip)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #cc6633">^</span>                         <span style="color: #008000">#Beginning of string</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(                         <span style="color: #008000">#Start OR condition</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(                         <span style="color: #008000">#Begin first condition (City, State, Zip)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">City</span><span style="color: #0000ff">&gt;</span>[A-Za-z\.\-<span style="color: #ff0000">\s</span>]+)  <span style="color: #008000">#City</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">( (<span style="color: #0000ff">?:</span>,<span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>) | (<span style="color: #0000ff">?:</span><span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>) )<span style="color: #cc6633">\b</span>  <span style="color: #008000">#Comma, comma space, or space</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">State</span><span style="color: #0000ff">&gt;</span>[A-Za-z]{2})     <span style="color: #008000">#State</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?:</span><span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>)                   <span style="color: #008000">#Space</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">Zip</span><span style="color: #0000ff">&gt;</span><span style="color: #ff0000">\d</span>{5}(-<span style="color: #ff0000">\d</span>{4})<span style="color: #cc6633">?</span>)    <span style="color: #008000">#Zip</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">) |                       <span style="color: #008000">#End first condition</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(                         <span style="color: #008000">#Begin second condition (City, State)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">City</span><span style="color: #0000ff">&gt;</span>[A-Za-z<span style="color: #ff0000">\s</span>]+)      <span style="color: #008000">#City</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">( (<span style="color: #0000ff">?:</span>,<span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>) | (<span style="color: #0000ff">?:</span><span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>) )<span style="color: #cc6633">\b</span>  <span style="color: #008000">#Comma, comma space, or space</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">State</span><span style="color: #0000ff">&gt;</span>[A-Za-z]{2})     <span style="color: #008000">#State</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?:</span><span style="color: #ff0000">\s</span><span style="color: #cc6633">?</span>)                   <span style="color: #008000">#Space</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">) |                       <span style="color: #008000">#End second condition</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(                         <span style="color: #008000">#Begin third condition (Zip)</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">(<span style="color: #0000ff">?&lt;</span><span style="color: #006080">Zip</span><span style="color: #0000ff">&gt;</span><span style="color: #ff0000">\d</span>{5}(-<span style="color: #ff0000">\d</span>{4})<span style="color: #cc6633">?</span>)    <span style="color: #008000">#Zip</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">)                         <span style="color: #008000">#End third condition</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">)                         <span style="color: #008000">#End OR condition</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #cc6633">$</span>                         <span style="color: #008000">#End of string</span></pre>
<p><!--CRLF--></div>
</div>
<p> </p>
<p>I then incorporated the new Regular Expression into a simple .NET console application to test. The application prompts for an input and then outputs any valid combinations that are matched. The complete listing for the console application is below.</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff">using</span> System;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff">using</span> System.Text;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff">using</span> System.Text.RegularExpressions;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"> </pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span style="color: #0000ff">namespace</span> ConsoleApplication1</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">{</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">  <span style="color: #0000ff">class</span> Program</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">  {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> Main(<span style="color: #0000ff">string</span>[] args)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      <span style="color: #0000ff">string</span> addressToParse = String.Empty;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      Console.WriteLine(<span style="color: #006080">"Sample RegEx application to parse combinations of City, State, and Zip Code."</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      Console.WriteLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      Console.Write(<span style="color: #006080">"Enter address or &lt;Enter&gt; to Quit: "</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"> </pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      <span style="color: #0000ff">while</span> (<span style="color: #0000ff">true</span>)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        addressToParse = Console.ReadLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        <span style="color: #0000ff">if</span> (addressToParse.Length &gt; 0)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          ParseAddressSegments(addressToParse);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          Console.WriteLine();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          Console.Write(<span style="color: #006080">"Enter address or &lt;Enter&gt; to Quit: "</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        <span style="color: #0000ff">else</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          <span style="color: #0000ff">break</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"> </pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> ParseAddressSegments(<span style="color: #0000ff">string</span> addressToParse)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      StringBuilder pattern = <span style="color: #0000ff">new</span> StringBuilder();</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"#Parse address line into named groups (City, State, Zip)"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"^                         #Begining of string"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(                        #Start OR condition"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(                        #Begin first condition (City, State, Zip)"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;City&gt;[A-Za-z\.\-\s]+)  #City"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"( (?:,\s?) | (?:\s?) )\b  #Comma, comma space, or space"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;State&gt;[A-Za-z]{2})    #State"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?:\s?)                  #Space"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;Zip&gt;\d{5}(-\d{4})?)    #Zip"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@") |                      #End first condition"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(                        #Begin second condition (City, State)"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;City&gt;[A-Za-z\s]+)      #City"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"( (?:,\s?) | (?:\s?) )\b  #Comma, comma space, or space"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;State&gt;[A-Za-z]{2})    #State"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?:\s?)                  #Space"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@") |                      #End second condition"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(                        #Begin third condition (Zip)"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"(?&lt;Zip&gt;\d{5}(-\d{4})?)    #Zip"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@")                        #End third condition"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@")                        #End OR condition"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      pattern.Append(<span style="color: #006080">@"$                         #End of string"</span> + Environment.NewLine);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"> </pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      Regex rgx = <span style="color: #0000ff">new</span> Regex(pattern.ToString(), RegexOptions.IgnoreCase</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">                                                | RegexOptions.CultureInvariant</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">                                                | RegexOptions.IgnorePatternWhitespace</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">                                                | RegexOptions.Compiled);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      Match match = rgx.Match(addressToParse);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      <span style="color: #0000ff">if</span> (match.Success)</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> name <span style="color: #0000ff">in</span> rgx.GetGroupNames())</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          <span style="color: #0000ff">if</span> ( (match.Groups[name].Value != String.Empty) &amp;&amp; (name == <span style="color: #006080">"City"</span> || name == <span style="color: #006080">"State"</span> || name == <span style="color: #006080">"Zip"</span>))</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">            Console.WriteLine(<span style="color: #006080">@"{0} = "</span><span style="color: #006080">"{1}"</span><span style="color: #006080">""</span>, name, match.Groups[name].Value.Trim());</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">          }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">        }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">      }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">    }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"> </pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">  }</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">}</pre>
<p><!--CRLF--></div>
</div>
<p><a href="/wp-content/uploads/a-regular-expr…p-code-for-neta-regular-expression-regex-to-parse-city-state-and-zip-code-for-net/ConsoleApplication1.zip" target="_blank">Download the sample Visual Studio 2008 solution</a>.</p>
<p>Happy RegEx coding!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/12/27/a-regular-expression-regex-to-parse-city-state-and-zip-code-for-net/feed/</wfw:commentRss>
		<slash:comments>255</slash:comments>
		</item>
		<item>
		<title>ASP.NET DropDownList &#8211; Cannot have multiple items selected in a DropDownList</title>
		<link>http://www.msprogrammer.com/index.php/2009/12/17/aspnet-dropdownlist-cannot-have-multiple-items-selected-in-a-dropdownlist/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/12/17/aspnet-dropdownlist-cannot-have-multiple-items-selected-in-a-dropdownlist/#comments</comments>
		<pubDate>Thu, 17 Dec 2009 16:35:28 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/12/17/aspnet-dropdownlist-cannot-have-multiple-items-selected-in-a-dropdownlist/</guid>
		<description><![CDATA[Using the syntax ‘DropDownList1.SelectedIndex = 10;’ does not create an exception, but using the syntax ‘DropDownList.Items.FindByValue(“10”).Selected = true;’ can create the following exception: Cannot have multiple items selected in a DropDownList.&#160;&#160; at System.Web.UI.WebControls.DropDownList.VerifyMultiSelect() Calling ClearSelection() on the DropDownList first will avoid this exception. It is also a good idea to first check and make sure [...]]]></description>
			<content:encoded><![CDATA[<p>Using the syntax ‘DropDownList1.SelectedIndex = 10;’ does not create an exception, but using the syntax ‘DropDownList.Items.FindByValue(“10”).Selected = true;’ can create the following exception:   </p>
<blockquote><p>Cannot have multiple items selected in a DropDownList.&#160;&#160; at System.Web.UI.WebControls.DropDownList.VerifyMultiSelect() </p>
</blockquote>
<p>Calling ClearSelection() on the DropDownList first will avoid this exception. It is also a good idea to first check and make sure that the value actually exists as an item within the DropDownList as in the following example:    </p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">private</span> <span style="color: #0000ff">void</span> SetDropDownListSelectedItem(<span style="color: #0000ff">string</span> selectedValue)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">{</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">  ListItem li = DropDownList1.Items.FindByValue(selectedValue);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">  <span style="color: #0000ff">if</span> (li != <span style="color: #0000ff">null</span>)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">  {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    DropDownList1.ClearSelection();</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">    li.Selected = <span style="color: #0000ff">true</span>;</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">  }</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">}</pre>
<p><!--CRLF--></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/12/17/aspnet-dropdownlist-cannot-have-multiple-items-selected-in-a-dropdownlist/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Highlight Text in an ASP.NET TextBox Control</title>
		<link>http://www.msprogrammer.com/index.php/2009/12/15/highlight-text-in-an-aspnet-textbox-control/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/12/15/highlight-text-in-an-aspnet-textbox-control/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 01:46:03 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/12/15/highlight-text-in-an-aspnet-textbox-control/</guid>
		<description><![CDATA[A simple method to highlight the text within a textbox control when the control gets the focus: protected void Page_Load(object sender, EventArgs e) { //Add client javascript to highlight the value when the control receives the focus txtMyTextBox.Attributes.Add(&#34;onfocus&#34;, &#34;this.select();&#34;); } This is a nice and easy way to highlight a default value in a form [...]]]></description>
			<content:encoded><![CDATA[<p>A simple method to highlight the text within a textbox control when the control gets the focus:</p>
<div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper">
<div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #0000ff">protected</span> <span style="color: #0000ff">void</span> Page_Load(<span style="color: #0000ff">object</span> sender, EventArgs e)</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        {</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            <span style="color: #008000">//Add client javascript to highlight the value when the control receives the focus</span></pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">            txtMyTextBox.Attributes.Add(<span style="color: #006080">&quot;onfocus&quot;</span>, <span style="color: #006080">&quot;this.select();&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">        }</pre>
<p><!--CRLF--></div>
</div>
<p>
  <br />This is a nice and easy way to highlight a default value in a form or a search box.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/12/15/highlight-text-in-an-aspnet-textbox-control/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>IIS 7 does not include IISAPP.vbs script</title>
		<link>http://www.msprogrammer.com/index.php/2009/12/07/iis-7-does-not-include-iisappvbs-script/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/12/07/iis-7-does-not-include-iisappvbs-script/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 00:54:28 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/12/07/iis-7-does-not-include-iisappvbs-script/</guid>
		<description><![CDATA[IIS 7 did not carry over many of the VBS scripts that IIS 6 came with. In particular, IISAPP.vbs which was a tool used to list the running worker processes, is no longer available on IIS 7 / Windows Server 2008. IISAPP.vbs was often used to determine which IIS process to attach your Visual Studio [...]]]></description>
			<content:encoded><![CDATA[<p>IIS 7 did not carry over many of the VBS scripts that IIS 6 came with. In particular, IISAPP.vbs which was a tool used to list the running worker processes, is no longer available on IIS 7 / Windows Server 2008. IISAPP.vbs was often used to determine which IIS process to attach your Visual Studio debugger to.</p>
<p>Fortunately, AppCmd.exe, which is a more powerful tool, can be used to accomplish the same task. For instance, to list the running worker processes, issue the following command: <font size="2" face="Courier New">C:\Windows\System32\inetsrv\appcmd.exe list wp</font></p>
<p>A good write up on AppCmd.exe can be found at: <a href="http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe">http://learn.iis.net/page.aspx/114/getting-started-with-appcmdexe</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/12/07/iis-7-does-not-include-iisappvbs-script/feed/</wfw:commentRss>
		<slash:comments>129</slash:comments>
		</item>
		<item>
		<title>VseWSS CTP 1.3 &#8211; COM Exception</title>
		<link>http://www.msprogrammer.com/index.php/2009/12/04/vsewss-ctp-13-com-exception/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/12/04/vsewss-ctp-13-com-exception/#comments</comments>
		<pubDate>Fri, 04 Dec 2009 15:41:06 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[VseWSS]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/12/04/vsewss-ctp-13-com-exception/</guid>
		<description><![CDATA[While working with Visual Studio 2008 / VseWSS projects I occasionally see the following COM exception preventing the VS project from packaging or deploying to SharePoint: Error: System.Runtime.InteropServices.COMException System.Runtime.InteropServices.COMException (0&#215;80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. It turns out, at least in my experience, that this is caused [...]]]></description>
			<content:encoded><![CDATA[<p>While working with Visual Studio 2008 / VseWSS projects I occasionally see the following COM exception preventing the VS project from packaging or deploying to SharePoint:    </p>
<blockquote><p><font size="2" face="Courier New">Error: System.Runtime.InteropServices.COMException        <br />System.Runtime.InteropServices.COMException (0&#215;80004005): Error HRESULT E_FAIL has been returned from a call to a COM component.</font></p>
</blockquote>
<p>It turns out, at least in my experience, that this is caused by an error within the manifest.xml file which typically is due to a renamed file or a change in the project’s directory structure.</p>
<p>To resolve:</p>
<ol>
<li>Manually edit the manifest.xml correcting any errors and save.      </li>
<li>Close Visual Studio 2008 and then re-open the project. </li>
</ol>
<p>The VseWSS project should now package/ deploy without error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/12/04/vsewss-ctp-13-com-exception/feed/</wfw:commentRss>
		<slash:comments>217</slash:comments>
		</item>
		<item>
		<title>VseWSS CTP 1.3 Requires the WCF HTTP Activation feature of Windows Server 2008</title>
		<link>http://www.msprogrammer.com/index.php/2009/11/30/vsewss-ctp-13-requires-the-wcf-http-activation-feature-of-windows-server-2008/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/11/30/vsewss-ctp-13-requires-the-wcf-http-activation-feature-of-windows-server-2008/#comments</comments>
		<pubDate>Mon, 30 Nov 2009 22:44:39 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[VseWSS]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/11/30/vsewss-ctp-13-requires-the-wcf-http-activation-feature-of-windows-server-2008/</guid>
		<description><![CDATA[On a fresh install of Windows Server 2008, MOSS 2007, Visual Studio 2008, and the Visual Studio Extensions for Windows SharePoint Services I received the following error when trying to deploy or package a solution with VseWSS: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding [...]]]></description>
			<content:encoded><![CDATA[<p>On a fresh install of Windows Server 2008, MOSS 2007, Visual Studio 2008, and the Visual Studio Extensions for Windows SharePoint Services I received the following error when trying to deploy or package a solution with VseWSS:    </p>
<blockquote><p><font size="2" face="Courier New">The content type text/html; charset=utf-8 of the response message does not match the content type of the binding (text/xml; charset=utf-8). If using a custom encoder, be sure that the IsContentTypeSupported method is implemented properly. The first 1024 bytes of the response were: &#8216;&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot; &quot;</font><a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;"><font color="#000000" size="2" face="Courier New">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</font></a><font size="2" face="Courier New">&gt;</font></p>
</blockquote>
<p>Apparently the VseWSS CTP 1.3 uses the WCF in the deployment process and requires the Windows Server 2008 WCF HTTP Activation feature to be activated. To activate the WCF feature in Windows Server 2008 use the following steps:</p>
<ol>
<li>Open ‘Server Manager’ from Administrator Tools.      </li>
<li>Highlight the ‘Features’ node under Server Manager.      </li>
<li>Click the ‘Add Features link on the right-hand side of the screen.      </li>
<li>Expand the ‘.NET Framework 3.0 Features’ node.      </li>
<li>Expand the ‘WCF Activation’ node.      </li>
<li>Check ‘HTTP Activation’ (required). Optionally you mat wish to check the ‘Non-HTTP Activation’ feature if you will be using WCF projects that utilize this, but it is not required for the VseWSS to work.      </li>
<li>Click Next to install. </li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/11/30/vsewss-ctp-13-requires-the-wcf-http-activation-feature-of-windows-server-2008/feed/</wfw:commentRss>
		<slash:comments>518</slash:comments>
		</item>
		<item>
		<title>Error activating the Office SharePoint Server Publishing Infrastructure feature</title>
		<link>http://www.msprogrammer.com/index.php/2009/11/29/error-activating-the-office-sharepoint-server-publishing-infrastructure-feature/</link>
		<comments>http://www.msprogrammer.com/index.php/2009/11/29/error-activating-the-office-sharepoint-server-publishing-infrastructure-feature/#comments</comments>
		<pubDate>Sun, 29 Nov 2009 17:31:57 +0000</pubDate>
		<dc:creator>bwalls</dc:creator>
				<category><![CDATA[SharePoint]]></category>
		<category><![CDATA[MOSS 2007]]></category>

		<guid isPermaLink="false">http://www.msprogrammer.com/index.php/2009/11/29/error-activating-the-office-sharepoint-server-publishing-infrastructure-feature/</guid>
		<description><![CDATA[I have noticed the following error a few times when activating the MOSS Publishing Infrastructure feature on a newly created site collection: Failed to activate feature &#8216;PublishingPrerequisites&#8217; (ID: a392da98-270b-4e85-9769-04c0fde267aa) at scope &#8216;http://[url]&#8216;. Typically opening a command prompt (as administrator) and running an ‘iisreset /noforce’ will resolve this error.]]></description>
			<content:encoded><![CDATA[<p>I have noticed the following error a few times when activating the MOSS Publishing Infrastructure feature on a newly created site collection: </p>
<blockquote><p><font size="2" face="Courier New">Failed to activate feature &#8216;PublishingPrerequisites&#8217; (ID: a392da98-270b-4e85-9769-04c0fde267aa) at scope &#8216;</font><a href="http://[url]'"><font color="#000000" size="2" face="Courier New">http://[url]&#8216;</font></a><font size="2" face="Courier New">.</font></p>
</blockquote>
<p>Typically opening a command prompt (as administrator) and running an ‘iisreset /noforce’ will resolve this error.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.msprogrammer.com/index.php/2009/11/29/error-activating-the-office-sharepoint-server-publishing-infrastructure-feature/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
