<?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>ganshani.com &#187; .NET</title>
	<atom:link href="http://www.ganshani.com/tag/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ganshani.com</link>
	<description>Puneet Ghanshani - .NET, Silverlight, Sharepoint Articles, Blogs, Poems, Photograph</description>
	<lastBuildDate>Sat, 24 Apr 2010 10:17:16 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Webinar: Features of .NET 4.0</title>
		<link>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/</link>
		<comments>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/#comments</comments>
		<pubDate>Sun, 18 Apr 2010 18:56:21 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[session]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=570</guid>
		<description><![CDATA[
			
				
			
		
Today, I delivered a Webinar on &#8216;Features of .NET 4.0&#8216;
Total duration of webinar: 1 hour
Total participants: 200
Take away from the session:

Features of .NET 4.0
Optimizations in .NET 4.0 vs .NET 3.5
New look of WCF in .NET 4.0
New in Silverlight 4.0

]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F18%2Fwebinar-features-of-net-4-0%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2010%2F04%2F18%2Fwebinar-features-of-net-4-0%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Today, I delivered a Webinar on &#8216;<strong>Features of .NET 4.0</strong>&#8216;</p>
<p><strong>Total duration of webinar:</strong> 1 hour<br />
<strong>Total participants: </strong>200</p>
<p><strong>Take away from the session:</strong></p>
<ul>
<li>Features of .NET 4.0</li>
<li>Optimizations in .NET 4.0 vs .NET 3.5</li>
<li>New look of WCF in .NET 4.0</li>
<li>New in Silverlight 4.0</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2010/04/18/webinar-features-of-net-4-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Finding currently focused control</title>
		<link>http://www.ganshani.com/2009/05/14/finding-currently-focused-control/</link>
		<comments>http://www.ganshani.com/2009/05/14/finding-currently-focused-control/#comments</comments>
		<pubDate>Thu, 14 May 2009 09:14:36 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[winforms]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=251</guid>
		<description><![CDATA[This article deals with finding currently focused control in Winform applications.


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/06/10/winform-tip3avoiding-multiple-instances-of-child-forms/' rel='bookmark' title='Permanent Link: Winform Tip#3:Avoiding multiple instances of child forms'>Winform Tip#3:Avoiding multiple instances of child forms</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/combobox-sorting-defect/' rel='bookmark' title='Permanent Link: ComboBox Sorting Defect!'>ComboBox Sorting Defect!</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F05%2F14%2Ffinding-currently-focused-control%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F05%2F14%2Ffinding-currently-focused-control%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Good question!  Now, this was a question in one of my sessions at Microsoft Community at Cognizant.  We need to use User32 API&#8217;s to do this stuff. It isn&#8217;t that difficult. Just a small snippet and you are through!</p>
<p>Here&#8217;s the neat solution.</p>
<p><span style="color: #0000ff;">[DllImport("user32.dll", CharSet=CharSet.Auto, CallingConvention=CallingConvention.Winapi)]<br />
internal static extern IntPtr GetFocus();</span></p>
<p>private Control GetFocusedControl()<br />
{<br />
          Control focusedControl = null;</p>
<p>          // To get hold of the focused control:<br />
          IntPtr focusedHandle = GetFocus();</p>
<p>          if(focusedHandle != IntPtr.Zero){</p>
<p>                 // Note that if the focused Control is not a .Net control, then this will return null.<br />
                focusedControl = Control.FromHandle(focusedHandle);<br />
         }<br />
         return focusedControl;<br />
}</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/06/10/winform-tip3avoiding-multiple-instances-of-child-forms/' rel='bookmark' title='Permanent Link: Winform Tip#3:Avoiding multiple instances of child forms'>Winform Tip#3:Avoiding multiple instances of child forms</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/combobox-sorting-defect/' rel='bookmark' title='Permanent Link: ComboBox Sorting Defect!'>ComboBox Sorting Defect!</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/05/14/finding-currently-focused-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ComboBox Sorting Defect!</title>
		<link>http://www.ganshani.com/2009/02/24/combobox-sorting-defect/</link>
		<comments>http://www.ganshani.com/2009/02/24/combobox-sorting-defect/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 10:35:25 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[winforms]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=166</guid>
		<description><![CDATA[
			
				
			
		
Oops! Never expected this behavior from such a standard control: Winforms ComboBox.
One of the common things our applications require is bind a data source with Collection-base UI elements like ComboBox. The best code any one could write would be: 
cmbTest.DisplayMember = "Name";
cmbTest.ValueMember = "ID";
cmbTest.DataSource = _employeeRecords; 
I would give this a perfect 10!
The combo box displays all [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/' rel='bookmark' title='Permanent Link: VS 2008 : Plugin Pop-up issue'>VS 2008 : Plugin Pop-up issue</a></li>
<li><a href='http://www.ganshani.com/2009/05/10/winform-tip1-transparent-form/' rel='bookmark' title='Permanent Link: Winform Tip#1: Transparent Form'>Winform Tip#1: Transparent Form</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F02%2F24%2Fcombobox-sorting-defect%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F02%2F24%2Fcombobox-sorting-defect%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Oops! Never expected this behavior from such a standard control: Winforms ComboBox.</p>
<p>One of the common things our applications require is bind a data source with Collection-base UI elements like ComboBox. The best code any one could write would be: </p>
<pre>cmbTest.DisplayMember = "Name";
cmbTest.ValueMember = "ID";
cmbTest.DataSource = _employeeRecords; </pre>
<p>I would give this a perfect 10!</p>
<p>The combo box displays all the Employee Names in the combo box.  What if you wanted to sort these items?</p>
<p>Let&#8217;s use the Sorted property of ComboBox.</p>
<pre>this.cmbTest.Sorted = true;</pre>
<p>Dush!!!  The code stopped working.</p>
<p>You won&#8217;t see Employee Names in the combo box any more. What you would come through is items showing the namespace of the object</p>
<pre>_employeeRecords</pre>
<p>Now did you expect that?</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/' rel='bookmark' title='Permanent Link: VS 2008 : Plugin Pop-up issue'>VS 2008 : Plugin Pop-up issue</a></li>
<li><a href='http://www.ganshani.com/2009/05/10/winform-tip1-transparent-form/' rel='bookmark' title='Permanent Link: Winform Tip#1: Transparent Form'>Winform Tip#1: Transparent Form</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/02/24/combobox-sorting-defect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exception Message Box in C#</title>
		<link>http://www.ganshani.com/2009/02/24/exception-message-box-in-c/</link>
		<comments>http://www.ganshani.com/2009/02/24/exception-message-box-in-c/#comments</comments>
		<pubDate>Tue, 24 Feb 2009 09:01:47 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[mytracker]]></category>
		<category><![CDATA[sql]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=163</guid>
		<description><![CDATA[
			
				
			
		
 
Its time to forget the old traditional message box with limited functionalities. buttons, icons, text area and what not! Microsoft has unleashed a new message box &#8211; new, yet not so new.
For those who have used SQL Sever 2005 GUI, might have probably noticed a message box that shows additional information, copying the text to [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2008/07/12/dlin/' rel='bookmark' title='Permanent Link: DLINQ'>DLINQ</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F02%2F24%2Fexception-message-box-in-c%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2009%2F02%2F24%2Fexception-message-box-in-c%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p> </p>
<p>Its time to forget the old traditional message box with limited functionalities. buttons, icons, text area and what not! Microsoft has unleashed a new message box &#8211; new, yet not so new.</p>
<p>For those who have used SQL Sever 2005 GUI, might have probably noticed a message box that shows additional information, copying the text to clipboard, a checkbox on message box, different set of buttons and many more features.  This message box is now open for reuse in your applications. </p>
<p>This is not a &#8216;big-bang&#8217; release made by Microsoft.  It has come out very quietly. Yes the name &#8216;ExceptionMessageBox&#8217; is confusing &#8211; but you can still use it in your applications. This standalone exception dialog box can be used in applications just like any other managed APIs.</p>
<p>Probably, you never know the next version of myTracker may use this message box too <img src='http://www.ganshani.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Let&#8217;s hear it from Microsoft:</p>
<p><span style="color: #800000;"><em>The exception message box is a programmatic interface that you can use in your applications for any tasks for which MessageBox may be used. The exception message box is a supported managed assembly designed to elegantly handle managed code exceptions. It provides significantly more control over the messaging experience and gives your users the options to save error message content for later reference and to get help on messages.</em></span></p>
<p>Download Link: </p>
<p><strong>http://download.microsoft.com/download/f/7/4/f74cbdb1-87e2-4794-9186-e3ad6bd54b41/SQLServer2005_EMB.msi </strong></p>
<div></div>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2008/07/12/dlin/' rel='bookmark' title='Permanent Link: DLINQ'>DLINQ</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2009/02/24/exception-message-box-in-c/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Smart Client with Enterprise Library 4</title>
		<link>http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/</link>
		<comments>http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 15:09:08 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[EL]]></category>
		<category><![CDATA[Smart Client]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=132</guid>
		<description><![CDATA[
			
				
			
		
Wow!  Compatibility between SCSF and EL 4 has troubled me many a times in some of my critical projects. Visual Studio 2008 does not allow installation of EL 3.1 and SCSF is based on EL 3.1.
To install EL 4.0 and to make it compatible with SCSF on VS2008 &#8211; here are the steps:
1. Rebuild Block [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2009/05/14/finding-currently-focused-control/' rel='bookmark' title='Permanent Link: Finding currently focused control'>Finding currently focused control</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F11%2F29%2Fusing-smart-client-with-enterprise-library-4%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F11%2F29%2Fusing-smart-client-with-enterprise-library-4%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Wow!  Compatibility between SCSF and EL 4 has troubled me many a times in some of my critical projects. Visual Studio 2008 does not allow installation of EL 3.1 and SCSF is based on EL 3.1.</p>
<p>To install EL 4.0 and to make it compatible with SCSF on VS2008 &#8211; here are the steps:</p>
<p>1. Rebuild Block Assemblies<br />
2. Update Guidance Package<br />
3. Update SCSF Application<br />
 </p>
<h1><strong><span style="color: #0000ff;">Rebuild Block Assemblies</span></strong></h1>
<p class="MsoNormal"><strong><span>1.</span></strong><span> </span><span>Extract the</span><span> </span><strong><span>Smart Client Software Factory Source Code</span></strong><span>.</span></p>
<p class="MsoNormal"><strong><span>2.</span></strong><span> </span><span>Open the</span><span> </span><strong><span>SmartClient.Offline</span></strong><span> </span><span>solution located at the source code installation folder.</span></p>
<p class="MsoNormal"><strong><span>3.</span></strong><span> </span><span>Remove from the</span><span> </span><strong><span>SmartClient.EnterpriseLibrary</span></strong><span> </span><span>and</span><span> </span><strong><span>SmartClient.EnterpriseLibrary.Tests</span></strong><span> </span><span>projects the references to the following assemblies:</span></p>
<p class="MsoNormal"><span><span>     &#8211; <span> </span></span></span><em><span>Microsoft.Practices.EnterpriseLibrary.Common<br />
<span style="font-style: normal;"><span><span>     -<span>  </span></span></span><em><span>Microsoft.Practices.EnterpriseLibrary.Data<br />
<span style="font-style: normal;"><span><span>     &#8211; <span> </span></span></span><em><span>SmartClient.EnterpriseLibrary.Data.SqlCe</span></em></span></span></em></span></span></em></p>
<p class="MsoNormal"><strong><span>4.</span></strong><span> </span><span>Add, In the</span><span> </span><strong><span>SmartClient.EnterpriseLibrary</span></strong><span> </span><span>and</span><span> </span><strong><span>SmartClient.EnterpriseLibrary.Tests</span></strong><span> </span><span>projects, references to the following Enterprise Library assemblies (located at Enterprise Library assemblies located at</span><span> </span><strong><span>%Enterprise Library 4 installation folder%\Bin</span></strong><span>):</span></p>
<p class="MsoNormal"><span><span>     &#8211; <span> </span></span></span><em><span>Microsoft.Practices.EnterpriseLibrary.Common.dll<br />
<span style="font-style: normal;"><span><span>     &#8211; <span> </span></span></span><em><span>Microsoft.Practices.EnterpriseLibrary.Data.dll<br />
<span style="font-style: normal;"><span><span>     &#8211; <span> </span></span></span><em><span>Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll</span></em></span></span></em></span></span></em></p>
<p class="MsoNormal"><strong><span>5.</span></strong><span> </span><span>In the</span><span> </span><strong><span>SmartClient.EnterpriseLibrary</span></strong><span> </span><span>project, open</span><span> </span><strong><span>SmartClientDatabase.cs</span></strong><span> </span><span>file and replace the following</span><span> </span><strong><span>using</span></strong><span> </span><span>statement:</span></p>
<p><span>using Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe;</span></p>
<p class="MsoNormal"><strong><span>with:</span></strong><span> </span></p>
<p><strong></strong>using Microsoft.Practices.EnterpriseLibrary.Data.SqlCe;</p>
<p> </p>
<h1><strong><span><span style="color: #0000ff;">Updating the Guidance Package</span><br />
 </span></strong></h1>
<p> </p>
<p> </p>
<p class="MsoNormal"><strong><span>1.</span></strong><span> </span><span>Open the</span><span> </span><strong><span>GuidancePackage</span></strong><span> </span><span>solution located at the SC-SF source folder.</span></p>
<p class="MsoNormal"><strong><span>2.</span></strong><span> </span><span>Open the</span><span> </span><strong><span>App.config.template</span></strong><span> </span><span>located under the folders located at</span><span> </span><strong><span>Templates\Solutions\Projects\Shell.*.*</span></strong><span> </span><span>(<em>Shell.Basic.CS, Shell.Basic.VB, Shell.Extended.CS and Shell.Extended.VB</em>) in the</span><span> </span><strong><span>SmartClientFactoryPackage</span></strong><span> </span><span>project.</span></p>
<p class="MsoNormal"><strong><span>3.</span></strong><span> </span><span>Find and replace on each</span><span> </span><strong><span>App.config.template</span></strong><span> </span><span>file the string “<strong>Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</strong>” with “<strong>Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</strong>”.</span></p>
<p class="MsoNormal"><strong><span>4.</span></strong><span> </span><span>Create a folder to store the new assemblies (e.g. at %SC-SF installation folder%\Lib with EntLib 4.0). In this folder, copy the Enterprise Library 4.0 assemblies and the Smart Client assemblies generated in Step 1. You should have the same assemblies you have at %SC-SF installation folder%\Lib but updated to use Enterprise Library 4.0.</p>
<p></span></p>
<p class="MsoNormal"><strong><span>5.</span></strong><span> </span><span>Open the file</span><span> </span><strong><span>CreateSmartClientFactorySolutionCommon.xml</span></strong><span> </span><span>file located at</span><span> </span><strong><span>Recipes\Common</span></strong><span> </span><span>folder of the</span><span> </span><strong><span>SmartClientFactoryPackage</span></strong><span> </span><span>project. You will change the path where the Create Solution recipe looks for the required assemblies by default.</span></p>
<p class="MsoNormal"><strong><span><br />
6.</span></strong><span> </span><span>Find the</span><span> </span><strong><span>SupportLibrariesPath</span></strong><span> </span><span>argument and replace it with the following:</span></p>
<div>
<p class="MsoNormal"><span>&lt;Argument Name=&#8221;SupportLibrariesPath&#8221; Required=&#8221;true&#8221; Type=&#8221;System.String&#8221;&gt;<br />
<span>  </span>&lt;ValueProvider Type=&#8221;Evaluator&#8221; Expression=&#8221;Paste here the path to the folder created at Step 4&#8243;&gt;<br />
<span>  </span>&lt;/ValueProvider&gt;<br />
&lt;/Argument&gt;</span></p>
</div>
<p class="MsoNormal"><span><strong><span>7.</span></strong><span> </span><span>Save all.</span></span></p>
<p class="MsoNormal"><strong><span>8.</span></strong><span> </span><span>Register the custom Guidance Package. To do this, right click the</span><span> </span><strong><span>SmartClientFactoryPackage</span></strong><span> </span><span>project and select</span><span> </span><strong><span>Register Guidance Package</span></strong><span>.</span></p>
<p> </p>
<h1></h1>
<h1><span style="color: #0000ff;">Update existing SCSF Application</span></h1>
<p> </p>
<p class="MsoNormal"><strong><span>1.</span></strong><span> </span><span>If your solution uses the</span><span> </span><strong><span>Microsoft.Practices.SmartClient.EnterpriseLibrary.dll</span></strong><span> </span><span>assembly, follow the steps described in the</span><span> </span><strong><span>Rebuilding the Block Assemblies</span></strong><span> </span><span>section to update this assembly and perform the following sub-steps:</span><span></span></p>
<ol type="1">
<li> 
<ol type="1">
<li class="MsoNormal"><span>Find       the</span><span> </span><strong><span>Microsoft.Practices.SmartClient.EnterpriseLibrary.dll</span></strong><span> </span><span>generated assembly located       at</span><span> </span><strong><span>%Source code installation       folder%\Blocks\Offline\Source\DataAccess.EnterpriseLibrary\bin\Debug</span></strong><span>.</span></li>
<li class="MsoNormal"><span>Copy       the previous assembly and replace them in the</span><span> </span><strong><span>Lib</span></strong><span> </span><span>folder of your solution.</span></li>
<li class="MsoNormal"><span>Update       the references of your projects to use the updated</span><span> </span><strong><span>Microsoft.Practices.SmartClient.EnterpriseLibrary.dll</span></strong><span> </span><span>assembly</span></li>
<li class="MsoNormal"><span>Remove       the reference to</span><span> </span><strong><span>Microsoft.Practices.SmartClient.EnterpriseLibrary.Data.SqlCe.dll</span></strong><span> </span><span>(it was replaced with the       one provided by</span><span> </span><strong><span>Enterprise Library 4</span></strong><span>) and add a reference to</span><span> </span><strong><span>Microsoft.Practices.EnterpriseLibrary.Data.SqlCe.dll</span></strong><span> </span><span>assembly located at</span><span> </span><strong><span>%Enterprise Library 4       installation folder%\Bin</span></strong><span>.</span></li>
</ol>
</li>
</ol>
<p class="MsoNormal"><strong><span>2.</span></strong><span> </span><span>Copy the Enterprise Library 4.0 assemblies (located at</span><span> </span><strong><span>%Enterprise Library 4 installation folder%\Bin</span></strong><span>) and replace them in the</span><span> </span><strong><span>Lib</span></strong><span> </span><span>folder of your solution.</span></p>
<p class="MsoNormal"><strong><span>3.</span></strong><span> </span><span>Update the references to the</span><span> </span><strong><span>Enterprise Library</span></strong><span> </span><span>assemblies in all the projects in your solution using the new assemblies copied into the</span><span> </span><strong><span>Lib</span></strong><span> </span><span>folder.</span></p>
<p class="MsoNormal"><strong><span>4.</span></strong><span> </span><span>Open the</span><span> </span><strong><span>App.config</span></strong><span> </span><span>file and find and replace the string</span><span> </span><strong><span>“Version=3.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</span></strong><span>” with “<strong>Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</strong>”.</span></p>
<p><strong><span>5.</span></strong><span> </span><span>Save all</span></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2009/05/14/finding-currently-focused-control/' rel='bookmark' title='Permanent Link: Finding currently focused control'>Finding currently focused control</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Strong Naming an existing assembly</title>
		<link>http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/</link>
		<comments>http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 04:15:50 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[MSIL]]></category>
		<category><![CDATA[strong name]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=125</guid>
		<description><![CDATA[
			
				
			
		
Now this is one problem that we face when we use a 3rd party DLL, which is not-strongly named &#38; we still want to dump it to GAC.
So, lets see the 5-step solution:


Go to Visual Studio Command Prompt
Generate a Strong Name Key File
sn -k keyPair.snk 
Obtain MSIL for the assembly
ildasm Assembly.dll /out:Assembly.il 
 
Rename the original assembly
ren Assembly.dll [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/06/28/bluetooth-with-csharp/' rel='bookmark' title='Permanent Link: Bluetooth with C#'>Bluetooth with C#</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F09%2F06%2Fstrong-naming-an-existing-assembly%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F09%2F06%2Fstrong-naming-an-existing-assembly%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p style="text-align: left;">Now this is one problem that we face when we use a 3rd party DLL, which is not-strongly named &amp; we still want to dump it to GAC.</p>
<p style="text-align: left;">So, lets see the 5-step solution:</p>
<p style="text-align: left;">
<ol>
<li>Go to Visual Studio Command Prompt</li>
<li><strong>Generate a Strong Name Key File</strong><br />
sn -k keyPair.snk </li>
<li><strong>Obtain MSIL for the assembly</strong><br />
ildasm Assembly.dll /out:Assembly.il <br />
 </li>
<li><strong>Rename the original assembly</strong><br />
ren Assembly.dll Assembly.dll.old <br />
 </li>
<li><strong>Create a new assembly from MSIL &amp; Key File</strong><br />
ilasm Assembly.il /dll /key= keyPair.snk </li>
</ol>
<div>The new Assembly is a strong-named assembly.</div>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/06/28/bluetooth-with-csharp/' rel='bookmark' title='Permanent Link: Bluetooth with C#'>Bluetooth with C#</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>VS 2008 : Plugin Pop-up issue</title>
		<link>http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/</link>
		<comments>http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/#comments</comments>
		<pubDate>Tue, 02 Sep 2008 14:49:57 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[VS2008]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=121</guid>
		<description><![CDATA[
			
				
			
		
While adding a pop-up to a plugin, designed in VS 2008, one of the commonly faced problem is:
Error 1 The best overloaded method match for &#8216;EnvDTE80.Commands2.AddNamedCommand2(EnvDTE.AddIn, string, string, string, bool, object, ref System.Array, int, int, EnvDTE80.vsCommandControlType)&#8217; has some invalid arguments C:\Punit Ganshani\Desktop Applications\MyAddin2\MyAddin2\Connect.cs 40 24 MyAddin2
Error 2 Argument &#8216;7&#8242;: cannot convert from &#8216;ref object[]&#8216; to &#8216;ref System.Array&#8217; C:\Punit Ganshani\Desktop Applications\MyAddin2\MyAddin2\Connect.cs 40 140 MyAddin2
Resolution:
Change:
object []contextGUIDS = new object[] [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/07/12/dlin/' rel='bookmark' title='Permanent Link: DLINQ'>DLINQ</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F09%2F02%2Fvs-2008-plugin-pop-up-issue%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F09%2F02%2Fvs-2008-plugin-pop-up-issue%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>While adding a pop-up to a plugin, designed in VS 2008, one of the commonly faced problem is:</p>
<p>Error 1 The best overloaded method match for &#8216;EnvDTE80.Commands2.AddNamedCommand2(EnvDTE.AddIn, string, string, string, bool, object, ref System.Array, int, int, EnvDTE80.vsCommandControlType)&#8217; has some invalid arguments C:\Punit Ganshani\Desktop Applications\MyAddin2\MyAddin2\Connect.cs 40 24 MyAddin2<br />
Error 2 Argument &#8216;7&#8242;: cannot convert from &#8216;ref object[]&#8216; to &#8216;ref System.Array&#8217; C:\Punit Ganshani\Desktop Applications\MyAddin2\MyAddin2\Connect.cs 40 140 MyAddin2</p>
<p><strong>Resolution:</p>
<p></strong>Change:<br />
<span style="font-size: x-small;"><span style="color: #0000ff;">object</span> []contextGUIDS = <span style="color: #0000ff;">new</span> <span style="color: #0000ff;">object</span>[] { };<br />
to:<br />
System.<strong><span style="color: #000080;">Array</span></strong></span><span style="font-size: x-small;"> contextGUIDS = <span style="color: #0000ff;">new</span> <span style="color: #0000ff;">object</span>[] { };</span></p>
<p><span style="font-size: x-small;">and it should compile &amp; execute perfectly.</span></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/07/12/dlin/' rel='bookmark' title='Permanent Link: DLINQ'>DLINQ</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DLINQ</title>
		<link>http://www.ganshani.com/2008/07/12/dlin/</link>
		<comments>http://www.ganshani.com/2008/07/12/dlin/#comments</comments>
		<pubDate>Sat, 12 Jul 2008 08:28:17 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[DLINQ]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[XLINQ]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=97</guid>
		<description><![CDATA[
			
				
			
		
DLinq (Data &#8211; Language Integrated Query) in .Net is one of the new &#38; powerful feature that Microsoft has introduced in .NET 3.5 framework.
Overview of Linq and how it is beneficial for Developers is explained in presentation &#38; the example:
Download the presentation &#38; example [ ZIP, 262 KB ]
Some of the key-benefits of Linq are:
- [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/23/dlinq-training-kit/' rel='bookmark' title='Permanent Link: DLinq training kit'>DLinq training kit</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/combobox-sorting-defect/' rel='bookmark' title='Permanent Link: ComboBox Sorting Defect!'>ComboBox Sorting Defect!</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F07%2F12%2Fdlin%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F07%2F12%2Fdlin%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>DLinq (Data &#8211; Language Integrated Query) in .Net is one of the new &amp; powerful feature that Microsoft has introduced in .NET 3.5 framework.</p>
<p>Overview of Linq and how it is beneficial for Developers is explained in presentation &amp; the example:<br />
<a href="http://www.ganshani.com/downloads/linq.zip">Download the presentation &amp; example</a> [ ZIP, 262 KB ]</p>
<p>Some of the key-benefits of Linq are:</p>
<p>- Unified querying of Objects, Database and XML eases the interaction between XML and databases.<br />
- High performance<br />
- Lesser time to code resulting in faster &amp; improved productivity of developers.<br />
- Ease of switching from Disconnected/Offline mode to Online mode in Smart Client applications.</p>
<p style="PADDING-LEFT: 30px">Most Smart Client applications use XML as datasource in Offline mode &amp; use SQL database in the Online mode. Since only the datasource name changes and other code remains AS-IS, it becomes easier to handle data.</p>
<p>Prerequisite for usage of sample application:<br />
- AdventureWorksDb Database (SQL Server 2005)</p>
<p>Punit Ganshani</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/09/23/dlinq-training-kit/' rel='bookmark' title='Permanent Link: DLinq training kit'>DLinq training kit</a></li>
<li><a href='http://www.ganshani.com/2009/02/24/combobox-sorting-defect/' rel='bookmark' title='Permanent Link: ComboBox Sorting Defect!'>ComboBox Sorting Defect!</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/07/12/dlin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bluetooth with C#</title>
		<link>http://www.ganshani.com/2008/06/28/bluetooth-with-csharp/</link>
		<comments>http://www.ganshani.com/2008/06/28/bluetooth-with-csharp/#comments</comments>
		<pubDate>Sat, 28 Jun 2008 18:25:18 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[Winform]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[bluetooth]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/?p=92</guid>
		<description><![CDATA[
			
				
			
		
Bluetooth Manager has following functionalities:
1. Discovery of devices
2. Finding out MAC address
3. Sending a File through Bluetooth

You can search the device, select one of the available ones and then send a text file to the user. The application uses In The Hand APIs. For more information about APIs: http://inthehand.com/
Click here to download the example


Related posts:Exception [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F06%2F28%2Fbluetooth-with-csharp%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F06%2F28%2Fbluetooth-with-csharp%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Bluetooth Manager has following functionalities:</p>
<p>1. Discovery of devices</p>
<p>2. Finding out MAC address</p>
<p>3. Sending a File through Bluetooth</p>
<p><img src="http://www.ganshani.com/wp-content/uploads/2008/06/bluetooth1.jpg" alt="Bluetooth UI" width="299" height="193" /></p>
<p>You can search the device, select one of the available ones and then send a text file to the user. The application uses In The Hand APIs. For more information about APIs: <a href="http://inthehand.com/">http://inthehand.com/</a></p>
<p><a href="http://cid-25b0875d174333fe.skydrive.live.com/self.aspx/.Public/Applications/POC/bluetoothpoc.zip">Click here to download the example</a></p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/02/24/exception-message-box-in-c/' rel='bookmark' title='Permanent Link: Exception Message Box in C#'>Exception Message Box in C#</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
<li><a href='http://www.ganshani.com/2008/09/06/strong-naming-an-existing-assembly/' rel='bookmark' title='Permanent Link: Strong Naming an existing assembly'>Strong Naming an existing assembly</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/06/28/bluetooth-with-csharp/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Only Numbers in TextBox</title>
		<link>http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/</link>
		<comments>http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/#comments</comments>
		<pubDate>Thu, 10 Apr 2008 16:06:11 +0000</pubDate>
		<dc:creator>Punit Ganshani</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Microsoft .NET]]></category>
		<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/</guid>
		<description><![CDATA[
			
				
			
		
Requirement: TextBox in C# should accept only numbers as input.
Solution:
Raise an event KeyPress and paste following line of code.
private void txtInput_KeyPress(object sender, KeyPressEventArgs e)
{
              if (!Char.IsNumber(e.KeyChar))
                 [...]


<h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/06/30/interface-vs-object-vs-aspect-oriented-programming/' rel='bookmark' title='Permanent Link: Interface vs Object vs Aspect Oriented Programming'>Interface vs Object vs Aspect Oriented Programming</a></li>
<li><a href='http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/' rel='bookmark' title='Permanent Link: VS 2008 : Plugin Pop-up issue'>VS 2008 : Plugin Pop-up issue</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F04%2F10%2Fonly-numbers-in-textbox%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.ganshani.com%2F2008%2F04%2F10%2Fonly-numbers-in-textbox%2F&amp;style=normal" height="61" width="50" /><br />
			</a>
		</div>
<p>Requirement: TextBox in C# should accept only <strong>numbers </strong>as input.</p>
<p>Solution:</p>
<p>Raise an event KeyPress and paste following line of code.</p>
<p>private void txtInput_KeyPress(object sender, KeyPressEventArgs e)<br />
{<br />
              if (!Char.IsNumber(e.KeyChar))<br />
                       e.Handled = true;<br />
}</p>
<p>Here, e stands for the arguments of the function and e contains several attributes and methods like:</p>
<p>e.KeyChar : Character that has been pressed<br />
e.Handled  : Whether it is an acceptable character or not.</p>


<p><h2>Related posts:</h2><ul><li><a href='http://www.ganshani.com/2009/06/30/interface-vs-object-vs-aspect-oriented-programming/' rel='bookmark' title='Permanent Link: Interface vs Object vs Aspect Oriented Programming'>Interface vs Object vs Aspect Oriented Programming</a></li>
<li><a href='http://www.ganshani.com/2008/09/02/vs-2008-plugin-pop-up-issue/' rel='bookmark' title='Permanent Link: VS 2008 : Plugin Pop-up issue'>VS 2008 : Plugin Pop-up issue</a></li>
<li><a href='http://www.ganshani.com/2008/11/29/using-smart-client-with-enterprise-library-4/' rel='bookmark' title='Permanent Link: Using Smart Client with Enterprise Library 4'>Using Smart Client with Enterprise Library 4</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://www.ganshani.com/2008/04/10/only-numbers-in-textbox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
