<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://msmvps.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>.Net Developement</title><link>http://msmvps.com/blogs/pauldomag/default.aspx</link><description>&lt;font face="Verdana" size="2"&gt;.Net related programming blogs. Mainly on Visual C# 2005 &lt;br /&gt;
&lt;em&gt;by: Paul June A. Domag&lt;/em&gt;&lt;/font&gt;</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP2 (Build: 40407.4157)</generator><item><title>This is a test</title><link>http://msmvps.com/blogs/pauldomag/archive/2009/09/12/this-is-a-test.aspx</link><pubDate>Sat, 12 Sep 2009 18:44:50 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:1722839</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=1722839</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2009/09/12/this-is-a-test.aspx#comments</comments><description>&lt;p&gt;testing 123 (Windows Live Writer)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=1722839" width="1" height="1"&gt;</description></item><item><title>Microsoft DigiDesk</title><link>http://msmvps.com/blogs/pauldomag/archive/2007/05/08/microsoft-digidesk.aspx</link><pubDate>Mon, 07 May 2007 23:59:27 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:893984</guid><dc:creator>Paul June</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=893984</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2007/05/08/microsoft-digidesk.aspx#comments</comments><description>&lt;p&gt;Ever watched StarTrek? Ever noticed the panels that they are using in the StarShip Enterprise? Well I guess this fiction wouldn’t be too fiction anyway. Microsoft introduced DigiDesk, their upcomming “futuristic” product that will let’s say, the trend of corporations in the next few years to come. I really love the demo, its quite impresive.&lt;/p&gt; &lt;p&gt;&lt;a href="http://webmag.mvps.org/?p=161"&gt;View Source&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=893984" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/pauldomag/archive/tags/News/default.aspx">News</category></item><item><title>Bill eats at Hooters!</title><link>http://msmvps.com/blogs/pauldomag/archive/2007/05/07/bill-eats-at-hooters.aspx</link><pubDate>Mon, 07 May 2007 16:38:14 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:893585</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=893585</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2007/05/07/bill-eats-at-hooters.aspx#comments</comments><description>&lt;p&gt;I just found this picture of Bill Gates and Warren Buffet with the &lt;a href="http://en.wikipedia.org/wiki/Hooters"&gt;Hooters Girls&lt;img src="http://shots.snap.com/images/v2.3.0.1/t.gif" alt="" /&gt;&lt;/a&gt;. I guess both of the world’s richest men (Bill Gates - #1, Warren Buffet - #3)&amp;nbsp;are having quite a good time. Though I’m not sure if its genuine (looks genuine enough for me).&lt;/p&gt; &lt;p&gt;&lt;a href="http://webmag.mvps.org/?p=158"&gt;Read at source&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=893585" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/pauldomag/archive/tags/News/default.aspx">News</category></item><item><title>Expression Blend Released!</title><link>http://msmvps.com/blogs/pauldomag/archive/2007/05/07/expression-blend-released.aspx</link><pubDate>Mon, 07 May 2007 16:33:42 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:893581</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=893581</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2007/05/07/expression-blend-released.aspx#comments</comments><description>&lt;p&gt;With the release of &lt;a href="http://silverlight.net/"&gt;Silverlight&lt;img src="http://shots.snap.com/images/v2.3.0.1/t.gif" alt="" /&gt;&lt;/a&gt; beta Microsoft also released its FlashApp killer, Expression Blend. Witht this, Microsoft is now enroute to a head on collision with Adobe. Expression Blend is just one of the product contained on the Expression Suite. A direct competitor of the Macromedia suite which was purchased by Adobe.&lt;/p&gt; &lt;p&gt;&lt;a href="http://webmag.mvps.org/?p=147"&gt;Read More&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=893581" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/pauldomag/archive/tags/News/default.aspx">News</category></item><item><title>Blog Moved!</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/10/03/Blog-Moved_2100_.aspx</link><pubDate>Tue, 03 Oct 2006 18:34:56 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:151924</guid><dc:creator>Paul June</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=151924</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/10/03/Blog-Moved_2100_.aspx#comments</comments><description>&lt;p&gt;Please refer to my new blogsite for some updated release. If you want to know just about programming in .Net then you can just subscribe to the Programming category...&lt;/p&gt; &lt;p&gt;My new blog site:&lt;/p&gt; &lt;p&gt;&lt;a href="http://webmag.mvps.org/"&gt;http://webmag.mvps.org/&lt;/a&gt;&lt;/p&gt; &lt;p&gt;All posts here were imported there. So all resources available here is also available on the new blog site...&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Thanks to msmvps.com for making the time to provide me a space to blog! 21 gun salute to you guys!&lt;/p&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=151924" width="1" height="1"&gt;</description></item><item><title>Optimizing your Startup</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/08/30/110988.aspx</link><pubDate>Wed, 30 Aug 2006 03:10:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:110988</guid><dc:creator>Paul June</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=110988</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/08/30/110988.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Many .Net programmers, including me, have complained on the slow startup of .Net applications. I know that this only occurs during the first execution of your application.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Why does this thing happen? It’s because of the JIT compiler. The JIT compiler tends to re-compile your .Net Assembly (.exe, .dll) to produce a native image of that assembly in your computer and store in a cache. As you might have already known, the assemblies that we are compiling in Visual Studio are not the native exe that is being produced in previous COM programming language (Visual Basic 6, Visual C++ 6.0, Delphi, etc.). These assemblies are being compiled to MSIL (Microsoft intermediate language) instead of its native counterpart. And as you might have guessed the MSIL couldn’t be executed directly by the computer and that’s where the JIT compiler comes in. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;You might be asking, “why not just do it upon compiling my own program in Visual Studio?” To figure this out, we must first learn why this kind of approach was used. The JIT compiler is not really a bad thing. Actually, it makes your program run faster. Well, here’s the concept behind this. The problem on the past COM languages is that even though the executables that they are producing are in native code, these codes are never compatible with other processors. I mean, every processor has its own specifics to enable your program to run faster. And this is where the COM languages fall short. Their executables are only optimized on their development machine. Hence, deploying it to other machines would decrease its compatibility with the processor (except if the developer box is exactly the same with the client box which is unlikely to happen).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;This is where the JIT compiler comes in. It recompiles your assembly to generate a native code that is fully compatible to your current CPU specifications. This makes your assembly run as fast as possible with your current hardware. But the problem is you’ll have to sacrifice your first execution because this is the time the JIT compiles your assembly. To make this clear, the JIT compiler recompiles your assembly when your assembly doesn’t have a native image in its cache. And the cache is being cleared every time you reboot your computer. So this means tat your program would be recompiled every time it is opened on a newly rebooted PC.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;But there is a way to tweak your application to make it load much faster even if it is its first time to load. How? Just load your application so that the JIT compiler compiles your program at startup without showing the main GUI of your application. How to do this? Well, I have just learned about this new tool in the Microsoft Framework 2.0 SDK. The ngen.exe. This tool pre-compiles your application and generates the needed native image in the cache. With this, the JIT compiler would not execute and recompile your application when it loads for the first time. Here’s the syntax (it’s being executed in the commandline):&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;C:\ngen install ClientApp.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Note: The ngen.exe is located in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;So you must include it in your path or in my case I just created my own batch file that executes whenever Windows XP starts up. Or you can just use the &lt;EM&gt;Visual Studio 2005 Command Prompt&lt;/EM&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;@@ Batch File Contents&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;PATH=” C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727”&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;FONT face="Courier New"&gt;&lt;FONT color=#0000ff&gt;Ngen install C:\Program Files\MyProg\App1.exe&lt;o:p&gt;&lt;/o:p&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&lt;FONT face="Courier New" color=#0000ff&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;To learn more about ngen (Native Image Generator). Just look it up on MSDN or in the online MSD help: &lt;A href="http://msdn2.microsoft.com"&gt;http://msdn2.microsoft.com&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=110988" width="1" height="1"&gt;</description></item><item><title>Creating an ActiveX Control in Visual Studio 2005</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/08/16/107758.aspx</link><pubDate>Wed, 16 Aug 2006 05:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:107758</guid><dc:creator>Paul June</dc:creator><slash:comments>21</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=107758</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/08/16/107758.aspx#comments</comments><description>&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;There have been misconceptions on technologies upon the arrival of .Net. Many programmers believe that the arrival of .Net means the scrapping of all previous technologies. Or in other word the COM technology.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;COM or ActiveX technology has been around us for very long. So it’s not quite easy to scrap a long-time proven technology. Some also believed that the .Net technology replaces the ActiveX in all applications. Well, sadly this is not true. I was awakened by this reality when I handled a code conversion project. It was a conversion from Visual Basic 6 to Visual Basic 8 (VB2005). The Visual Basic 6 project was a dll-based project with an ActiveX Document as its user interface. As we all know, user documents are controls that is embedded to a web page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;That’s when my problem began. What is ActiveX Document in .Net? What is its counterpart? Well, upon goog-ling a couple of hours to find the answer, in vain as I may add, it suddenly struck me. Instead of finding a counterpart, why not just re-use an old technology (ActiveX)? I must find a way to make my .Net object visible to COM applications or other ActiveX objects.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;This may sound very complex, but the solution that I found was pretty easy. I’ll do this step by step.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Step 1: Create a Class Library Project&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;IMG src="http://i54.photobucket.com/albums/g114/pauldomag/Standalone.jpg"&gt; 
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;After creating the project, delete Class1.cs coz we don’t need the file. What we need though is a User Control to contain our controls.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Step 2: Add a User Control&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;IMG src="http://i54.photobucket.com/albums/g114/pauldomag/update.jpg"&gt; 
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;This user control would host the UI that we would be placing in our Web Page. After adding, lets add a TextBox control in our user control.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Step 3: Create an Interface&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Since we are talking to a COM application, we must expose certain properties that the browser could use to modify parts of our component. This is exposed through our interface.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;public interface IComWrapper {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;string TextInTextBox { get; set; }&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;In our case, lets create a TextInTextBox string property. After doing that, implement the interface in our User Control.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;public partial class myControl : UserControl, IComWrapper&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;private string _userText = "";&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public myControl() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;InitializeComponent();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;#region IComWrapper Members&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;public string TextInTextBox {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;get {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;return _userText;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;set {&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;_userText = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;textBox1.Text = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;#endregion&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Step 4: Embed User Control in a browser&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Like its ActiveX counterpart, embedding a UserControl in a webpage is done through the usage of the object tag:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;object id="myControl1" name="myControl1" classid="ActiveXdotNet.dll#ActiveXdotNet.CustomerMaster"&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;style="width:100%; height:100%; background-color:ButtonFace; font-family:Arial; font-size:x-small"&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"&gt;&amp;lt;/object&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;As you may have noticed, the difference between using ActiveX and UserControl is its classid parameter. Instead of containing a GUID for our ActiveX, it contains the dll name followed by a # and the name of the namespace and the class.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Step 5: Access Browser&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;By this time, you have successfully embedded the UserControl in a webpage. But in order to see the effect you must place in a single folder the dll and your webpage and access it through your IIS. Just a reminder, don’t access your webpage by double-clicking it in your Windows Explorer for it will not show your UserControl. Access it with its full path in IIS (&lt;A href="http://localhost/ActiveXdotNet/Default.htm"&gt;http://localhost/ActiveXdotNet/Default.htm&lt;/A&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;STRONG&gt;Tricks&lt;o:p&gt;&lt;/o:p&gt;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;You can call your exposed properties by using a plain javascript. Use the Id of the object in your object tag as if it were the object itself. So when you do this in your web page:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;myControl1.TextInTextBox = “testing”;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;The textbox in your user control would change.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;Also, sometimes we would want to manipulate the webpage inside our UserControl. To do this we must expose a Window object property. This would serve as the container of the window object in javascript. After that let’s cast the value to IHTMLWindow2 so that we can access the browser’s functionalities.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P class=MsoNormal style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: Verdana"&gt;There you are! You have successfully built an Active-like control in your web paeg.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=107758" width="1" height="1"&gt;</description></item><item><title>Creating Control Arrays</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/08/02/106518.aspx</link><pubDate>Wed, 02 Aug 2006 18:27:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:106518</guid><dc:creator>Paul June</dc:creator><slash:comments>11</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=106518</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/08/02/106518.aspx#comments</comments><description>&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Control arrays are a very useful functionality in your application. They tend to simplify things that you are doing to a certain number of controls. For example, you want to disable a numerous number of textboxes, you wouldn’t have to code each textbox for disabling, instead you would just use a loop for disabling these certain controls.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;In the Visual Basic 6.0 era, creating control arrays are just a snap. Creating controls with the same name would automatically array your controls. But in the .Net era you cannot just do this by the fly (on your Design mode). So, how could you do this? I will present 3 ways of achieving this, being the last way as the most efficient way.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;The first approach is the crudest of them all. In this solution you intend to really create an array of controls. For the reason of demonstrating, let’s try creating an array of 50 textbox controls.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;TextBox[] textboxes = new &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;TextBox[50];&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;for (int i = 0; i &amp;lt; 50; i++) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;textboxes[ i].Width = 100;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;…&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;The problem as you see here is that you will manually place the controls in your form. Which would be quite problematic especially if you want to place controls which are not so relevant with each other.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;The second approach is to traverse the controls collection of the form. This is a very effective solution. But the problem is you’ll have to always check the name and type of the control &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;if it matches the controls you want to traverse as seen in this code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;foreach ( Control c in this.Controls) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;if (c.GetType().ToString() == “System.Windows.Forms.TextBox” &amp;amp;&amp;amp; c.Name == “myName”) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;….&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face="Courier New" size=2&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;The third and final solution is my preferred approach to this problem. First is you’ll have to name your controls in series. It means that your control names must have numeric values assigned to it. Think of it as an index for your control. Ex:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;TextBox1, TextBox2, TextBox3, …&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;After that, &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;you can now loop using the controls collection. But instead of looping with all of the controls lets directly get the name:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;for (int i = 0; i &amp;lt; 50; i++) {&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;TextBox txt = (TextBox) this.Controls[“TextBox” + i.ToString()];&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;Txt.Enabled = false;&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face="Courier New" size=2&gt;…&lt;BR&gt;}&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Well, as you can see the third solution is pretty simple and straight forward. No name verifications are required and at the same time you can also use your design mode to place your controls on the form. The only drawback I can see with this approach is you could not name your control to its exact descriptive names. But I think it’s quite a little sacrifice imaging the lines of code that you’ll save with this approach.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=106518" width="1" height="1"&gt;</description></item><item><title>Multiple Projects in a Single Solution in VS2005</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/08/02/106505.aspx</link><pubDate>Wed, 02 Aug 2006 17:02:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:106505</guid><dc:creator>Paul June</dc:creator><slash:comments>165</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=106505</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/08/02/106505.aspx#comments</comments><description>&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt"&gt;&lt;FONT face=Verdana size=2&gt;Creating Multiple Projects in a Single Solution is a pretty quite simple thing to do in Visual Studio 2003. It’s a matter of right clicking your solution in the solution explorer then select “Add New Project”. Well this simplicity has completely vanished upon the introduction of &lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp;&lt;/SPAN&gt;Visual Studio 2005.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;This matter has already been questioned a number of times in the &lt;A href="http://forums.microsoft.com"&gt;MSDN forums&lt;/A&gt;. And I guess it’s time for me to blog about this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;As I have mentioned earlier, this is a simple thing in Visual Studio 2003. But the problem in 2005 is that there is no solution being displayed in the Solution Explorer as seen here:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;IMG src="http://i54.photobucket.com/albums/g114/pauldomag/SolutionExplorer.jpg"&gt; 
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;I’ve tried creating a Blank Solution in the New Project Types. After creating a Blank solution, your solution could now be seen in your solution explorer. But the problem begins when you add a new project. On some unknown reason, upon adding a new project, the solution disappears again!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;So, how do we solve this dilemma? We need to show our solution file even if there’s a project contained in it. So how do we do that? Simple! It’s just in the IDE Options. Go to the&lt;SPAN style="mso-spacerun: yes"&gt;&amp;nbsp; &lt;/SPAN&gt;&lt;STRONG&gt;Tools&lt;/STRONG&gt; menu then select &lt;STRONG&gt;Options&lt;/STRONG&gt;. After that the Options dialog box would be displayed as seen here:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;IMG src="http://i54.photobucket.com/albums/g114/pauldomag/Options.jpg"&gt; 
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;o:p&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing style="MARGIN: 0in 0in 0pt; TEXT-ALIGN: justify"&gt;&lt;FONT face=Verdana size=2&gt;Just navigate to the &lt;STRONG&gt;Projects and Solutions&lt;/STRONG&gt; (its encircled in blue) and check the &lt;STRONG&gt;Always Show Solution&lt;/STRONG&gt; check box (its encircled in red). Voila! Your solution would then be displayed in the solution explorer. Then you can right-click it and add a new project.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=106505" width="1" height="1"&gt;</description></item><item><title>Sql Server 2005 Everywhere Edition</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/07/29/106130.aspx</link><pubDate>Sat, 29 Jul 2006 01:53:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:106130</guid><dc:creator>Paul June</dc:creator><slash:comments>3</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=106130</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/07/29/106130.aspx#comments</comments><description>&lt;IMG src="http://www.microsoft.com/library/toolbar/3.0/subbanner.aspx?t=TWljcm9zb2Z0IFNRTCBTZXJ2ZXI%3d&amp;amp;f=FFFFFF&amp;amp;b=757575&amp;amp;s=A7A7A7&amp;amp;r=False&amp;amp;font=Segoe%2c+13pt&amp;amp;v=0&amp;amp;c=xnKXIYwVXg%2bfM%2b32U1tB2ZdFHrQ%3d"&gt;&lt;BR&gt;
&lt;P class=MsoNoSpacing&gt;&lt;FONT face=Verdana size=2&gt;Tired of deployment problems with Sql Server? Ever wished that your database is just contained in a single file? Well, your wished has just been granted! Welcome to Sql Server Everywhere!&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;&lt;FONT face=Verdana size=2&gt;Sql Server Everywhere is a light-weight database solution designed for easy deployment. It’s a file based Sql Server that caters desktop and mobile applications. &lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;So what’s its difference with Sql Server Express? Sql Server Everywhere is designed to be used only by a single application. It means that it doesn’t support a multi-user interface. Only one user would be able to access your database at a time. Well, for me it isn’t that bad. If your developing an application that would only be used by one computer then Sql Server Everywhere is the right solution for you. Since the qualms of programmers is that Sql Server eats a lot of resources, even if you only need a simple database solution. That’s why other programmers are resulting into using Access instead of Sql Server. The problem I see with this is Access’ Sql compatibility. Some Sql Statements doesn’t work well in Access and this causes some kind of confusion on the part of the programmer.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;&lt;FONT face=Verdana size=2&gt;Sql Server Everywhere is a file based Database Solution. Which means that each database is just contained in a single file and you access them directly. The beauty of this new technology is its ability to upgrade to a full Sql Server specs in case a multi-user environment would be implemented.&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;&lt;FONT face=Verdana size=2&gt;Here's a table comparing Sql Server Everywhere and Sql Server Express:&lt;/FONT&gt;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class=MsoNoSpacing&gt;
&lt;TABLE class=dataTable id=ENC cellSpacing=0 cellPadding=0&gt;

&lt;TR class=stdHeader&gt;
&lt;TD id=colEQC&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD id=colEUC&gt;&lt;FONT face=Verdana size=1&gt;&lt;STRONG&gt;SQL Server 2005 Everywhere Edition&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD id=colEYC&gt;&lt;FONT face=Verdana size=1&gt;&lt;STRONG&gt;SQL Server Express Edition&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/TD&gt;&lt;/TR&gt;

&lt;TR class=record&gt;
&lt;TD&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When to use / benefits&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;TABLE cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Essential relational database functionality in a compact footprint&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Ideal for mobile and desktop applications, including occasionally connected&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Embeddable in applications&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Free to download, develop, deploy, and redistribute&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;TABLE cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Ideal for small server deployments as well as desktop applications with more rich requirements such as full text search and powerful XML query processing.&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Seamless upgrade to SQL Workgroup, Standard and Enterprise&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;Free to download, develop, deploy, and redistribute&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR class=evenRecord&gt;
&lt;TD&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When not to use&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;TABLE cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When you want to run as a service&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When you need a multi-user database server&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;You need the full functionality of SQL Server&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/TD&gt;
&lt;TD&gt;
&lt;TABLE cellSpacing=0 cellPadding=0&gt;

&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When the footprint and memory requirements need to be compact&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When you want to run in process&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;
&lt;TR&gt;
&lt;TD class=listBullet&gt;&lt;FONT face=Verdana size=1&gt;•&lt;/FONT&gt;&lt;/TD&gt;
&lt;TD class=listItem&gt;
&lt;P class=lastInCell&gt;&lt;FONT face=Verdana size=1&gt;When you want to target devices&lt;/FONT&gt;&lt;/P&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TABLE&gt;&lt;/P&gt;
&lt;DIV class=dataTableBottomMargin&gt;&lt;FONT face=Verdana size=1&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;P class=MsoNoSpacing&gt;&lt;BR&gt;&amp;nbsp;&lt;/P&gt;&lt;FONT face=Verdana size=2&gt;Other resources:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://www.microsoft.com/sql/ctp_sqlserver2005everywhereedition.mspx"&gt;Sql Server Everywhere Edition&lt;/A&gt;&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;&lt;BR&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyId=85E0C3CE-3FA1-453A-8CE9-AF6CA20946C3&amp;amp;displaylang=en"&gt;Download Sql Server Everywhere CTP&lt;/A&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=106130" width="1" height="1"&gt;</description></item><item><title>SqlServer 2005 Service Pack 1</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/04/24/92401.aspx</link><pubDate>Mon, 24 Apr 2006 20:43:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:92401</guid><dc:creator>Paul June</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=92401</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/04/24/92401.aspx#comments</comments><description>&lt;DIV&gt;SqlServer 2005 SP1 has just been released. Well a few days earlier I mean.&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Yep, since the release of SqlServer 2005 on November 2005, Microsoft releases the first its very first service pack. For the information of others, the service pack has been on CTP (Community Technical Preview) stage for a few months now. I guess microsoft really sees the advantage of releasing CTP's for the public. Really hope this attitude continues for future upcomming releases!&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;There are two seperate downloads. One for the SqlServer 2005 Express and the other is for Enterise, Developer and Standard editions. You can download it here:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=cb6c71ea-d649-47ff-9176-e7cac58fd4bc"&gt;SqlServer 2005 Service Pack 1&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Express edition:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://go.microsoft.com/fwlink/?LinkId=64064"&gt;SqlServer Express Service Pack 1&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;Here's a link on the list of fixes fixed in this release:&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;A href="http://support.microsoft.com/?kbid=913090"&gt;List of Bugs Fixed&lt;/A&gt;&lt;/DIV&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=92401" width="1" height="1"&gt;</description></item><item><title>The Database Express Editions Battle</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/04/18/91569.aspx</link><pubDate>Tue, 18 Apr 2006 21:46:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:91569</guid><dc:creator>Paul June</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=91569</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/04/18/91569.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;A mid-scale database solution is one of the booming businesses nowadays. Many mid-sized companies are now moving to the IT trend. One of the obstacles that a company might encounter is the cost of database systems. I mean it’s not quite feasible for a mid-sized company to purchase a SqlServer Enterprise which costs $24,999 plus 25 users CAL which amounts to $13,969 or an Oracle 10g enterprise which amounts up to $40,000.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Because of these obstacles that companies are reverting to open source database solutions which is free. That’s when MySql gained its popularity. Although MySql lacks some enterprise capabilities, (well, some that are not being used or needed by the company) its free. This means a lower cost on the company’s side.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Over the past few years this area of business is being dominated by MySql, Firebird, MS Access and Postgress. Not until now. Microsoft has just released last November 2005 its’ upgrade to the age-old MSDE (Microsoft Desktop Engine) the free database engine of Sql2000. It’s called SqlServer Express Edition.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;What about Oracle? You remember Oracle don’t you? Well, Oracle is currently the leading Database choice for enterprise applications just like SAP. With Oracle’s power come certain drawbacks just like the difficulty installing it. I personally experienced this when I was installing Oracle 9i on a development machine. It took me nearly 30 minutes to figure out on what I was doing. I think this is the real edge of SqlServer over Oracle, simplicity.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I guess this edge is becoming thinner now. Oracle has just released its new product that is very similar (or should I say a copycat) to SqlServer Express. And guess what it’s called? Oracle 10g XE (Express Edition). Quite similar indeed!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Well, Oracle XE is supposed to get rid of the complexity of usage of an Oracle database. For instance, the installer engine of Oracle which is the Universal Installer has been dropped off. Was I glad to hear that. Oracle XE is also a free database engine that caters mid-size solutions.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;For the simplicity of this blog I’m going to discuss Oracle XE and hopefully compare it to SqlServer Express. I’m going to drop-off MySql and other database engines for I am not using it. And in my opinion only these two are on the same level.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;IMG src="http://www.oracle.com/technology/products/database/xe/xe_logo.gif" align=left&gt;The Oracle XE could be also termed as a lightweight Oracle Database. It’s easier to install manage and configure. You might be wishful thinking if you think that it has no limitations. Well, the limitations as I view it are not that of a big deal. Here are the lists of limitations:&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;1.&amp;nbsp;Could only store for up to 4 GB of Data.&lt;BR&gt;2.&amp;nbsp;Could only use one processor (Although it can be installed on PC’s with multiple processors but it would only use just one processor)&lt;BR&gt;3.&amp;nbsp;Could only use 1 GB of memory.&lt;BR&gt;See, no big deal at all.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;SqlServer Express also has the same limitations with Oracle XE. So here comes the question, what to use? In my opinion many mid-sized database users are now using SqlServer Express, so why bother upgrade? I haven’t seen any mid-sized database requirement that Oracle could provide but SqlServer cannot. So sticking with your current technology isn’t such a bad thing. But if your starting to learn Database systems, or have plans being an Oracle DBA someday, then I suggest using Oracle XE.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In my case, I’ve been using SqlServer since its 2000 version. So I guess upgrading would really hurt me. But currently I’m still downloading the Oracle XE package. I’m pretty quite interested about this product for I am really impressed with the performance of Oracle. The SqlServer IDE is very superb that I doubt I’m gonna to shift to Oracle XE anytime soon. But for you .Net aficionados, you’ll have a treat with this. Coz Oracle XE can now be configured using Visual Studio. There is a tool for .Net that enables this.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The downside problem that I can see here is that the tool is currently on its Beta. And another issue was it couldn’t be installed on any Express editions IDE. Well I’ll still be trying it and maybe at long last I would be convinced on using Oracle.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=91569" width="1" height="1"&gt;</description></item><item><title>Record Paging in SQL Server</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/04/10/90330.aspx</link><pubDate>Mon, 10 Apr 2006 21:49:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:90330</guid><dc:creator>Paul June</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=90330</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/04/10/90330.aspx#comments</comments><description>&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;One of the most common problems during a development of a database application is displaying large amounts of data. Fetching all of the data from your server and displaying it directly in your application is not a very good idea. Coz fetching large amounts of data could clog your server or at worse makes your application non-responsive.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;A more common way of solving this problem is letting the user query the data first before displaying it. This would minimize the data being displayed and hence would lessen the memory consumption of your application. But what if the user really needs to browse all of the data in your table(s)? A very efficient way to solve this is by paging your data. Paging of data works in a way that you limit the view of your user. A perfect example of data paging is the Google search engine. Once you issue a query into the database only a limited SET of data is being returned per view. You can the move to the other page to see the next results.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;In the VB6 days this is done quite easily, coz the recordset object directly supports paging through its CacheSize, PageSize and PageCount properties.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/Default.asp?url=/technet/prodtechnol/windows2000serv/reskit/iisbook/c07_visual_basic_example__paging_through_a_recordset.asp"&gt;Visual Basic Example: Paging through a Recordset&lt;/A&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;As you may have now noticed, ADO .Net is very different with its predecessor (ADO). Since the loading of your data greatly depends on the interaction between DataAdapters&amp;nbsp; and Datatables the ability of data paging should be done before the DataAdapter loads your data in the Datatable. Which gives you no choice but to use sql server side code to do this.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;I have a friend that is an avid user of the mysql database. And I found out through him that you can do data paging through sql-scripts in mysql. But sadly, I can’t seem to find its equivalence in Sql Server.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;Ok, don’t give up your hope on sql server and jump directly to mysql for I have found a workaround for this.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;Before discussing the methods used to achieve data paging through sql server. I must say first that this is just my idea. This method doesn’t indicate that it’s the only way to achieve this. I’ve not yet tested it on very large databases, though I’ve tested it partially.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;Let’s start then.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;In the &lt;A href="http://forums.microsoft.com"&gt;MSDN forums&lt;/A&gt;, a lot of users have been asking this question. And most of their answers suggests to use the TOP keyword in sql server. Well, its not entirely effective since the top keyword only returns the first number of records that you wish to query. After that, you wouldn’t be able to get the next SET.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;To be able to get the next set we must have a record counter or a way numbering our records. You can’t achieve that by using an auto increment field coz this field would not be in order when deletions are made in your table. The numbering should occur upon querying the data. Here’s a solution that I’ve come up with:&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;--Create a View&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;SELECT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TOP (100) PERCENT COUNT(*) AS recnum, a.CustomerID, a.TerritoryID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;FROM&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sales.Customer AS a INNER JOIN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Sales.Customer AS b ON a.CustomerID &amp;gt;= b.CustomerID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;GROUP BY a.CustomerID, a.TerritoryID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;ORDER BY a.CustomerID&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;-- You can now select your data this way:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;SELECT * FROM vw_test WHERE recnum BETWEEN 100 AND 110&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;Upon testing this, I noticed that it was a little bit slow. It executed for 1:15! By the way the database that I used this query to is the Answerworks database. The table contains 19,000+ records.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;I know that the sql script was not that efficient. So I tried another way using a stored procedure. I numbered my records by creating a temporary table with an autonumber field. Here’s the script:&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;CREATE PROCEDURE sp_test &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @start int,&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @end int&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;AS&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;BEGIN&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DECLARE @tmpTable TABLE (&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; recnum int identity,&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CustomerId int,&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TerritoryId int&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; INSERT INTO @tmpTable(CustomerId, TerritoryId)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT CustomerId, TerritoryId FROM Sales.Customer&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SELECT * FROM @tmpTable WHERE recnum BETWEEN @start and @end&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ORDER BY recnum&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;END&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;GO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;-- You can use it this way:&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;EXECUTE sp_test 100, 110&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;GO&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;To my surprise it executed only at 25 seconds. Although it’s a little bit slow but at least it has greatly improved its performance compared to my view approach.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;I guess you have the final say on what approach you are going to use. But as you choose, take into consideration the length of the code that you are going to do vs. the number of records that you are trying to process.&lt;/FONT&gt;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;FONT face=Verdana size=2&gt;Either you choose method 1 or 2 the results of these could then be loaded into your datatable. You can then just change the limits (start, end) of your parameter to get the pages that you want your user to view to ease the burden from your application.&lt;/FONT&gt;&lt;/DIV&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=90330" width="1" height="1"&gt;</description></item><item><title>Code Master Challenge</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/04/06/89581.aspx</link><pubDate>Thu, 06 Apr 2006 17:20:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:89581</guid><dc:creator>Paul June</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=89581</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/04/06/89581.aspx#comments</comments><description>&lt;IMG src="http://i54.photobucket.com/albums/g114/pauldomag/CodeMasters.jpg"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Wonder what’s bugging this guy?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;It’s a new contest on Microsoft called the “Code Master Challenge”.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Yet another contest to entice developers to develop apps using the new features of the Delayed, yet upcoming, Windows Vista.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This contest comes with a cool cash prize up to $125,000! Ready to join yet?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The concept of the challenge is pretty quite straight forward. Develop an app that runs on Vista using the new Vista programming capabilities (As I guess, mainly WinFx). You’ll have to register in the website before July 31 2006 to become an eligible contestant (if you’re one of the first 200 to enter, you’ll get a freebie, Vista Polo shirt). Next, create a concept for your new application. You can visit the &lt;A href="http://www.codemasterchallenge.com/Inspiration.aspx"&gt;Inspiration Page&lt;/A&gt; to get some ideas. Also, take a look in the &lt;A href="http://www.codemasterchallenge.com/judges.aspx"&gt;Judging criteria&lt;/A&gt; to get an idea on how judges would score your application. After the creation of your app (or even before) create a PowerPoint presentation that describes your presentation. You must use the standard PowerPoint template which could be downloaded &lt;A href="http://www.codemasterchallenge.com/download.aspx?file=template/BestflowchartEVER.pps"&gt;here&lt;/A&gt;. If you would be chosen as a finalist, then you would have to present again your application but to the judges directly using Live Meeting. That’s it!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://www.codemasterchallenge.com/rules.aspx"&gt;The rules and regulations of the contest&lt;/A&gt;. (Beware, this is quite lengthy and it might bore you.)&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Prizes! You heard me right baby! Prizes, with a “s” which means you don’t need to be the lone winner of the contest to receive some cold cash.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;•&amp;nbsp;Grand prize: $50,000 &lt;BR&gt;•&amp;nbsp;1st prize: $30,000 &lt;BR&gt;•&amp;nbsp;2nd prize: $20,000 &lt;BR&gt;•&amp;nbsp;3rd prize: $15,000 &lt;BR&gt;•&amp;nbsp;20 finalists $500 each&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I’ve just finished registering, hoping for the Vista Polo Shirt to arrive at my doorsteps. Hehehehe...&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://www.codemasterchallenge.com/home.aspx"&gt;Here’s the official site&lt;/A&gt;.&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=89581" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/pauldomag/archive/tags/News/default.aspx">News</category></item><item><title>Code Refactoring</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/04/01/88823.aspx</link><pubDate>Sat, 01 Apr 2006 16:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:88823</guid><dc:creator>Paul June</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=88823</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/04/01/88823.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Another great new tool provided in VS2005 is Code Refactoring. What is Refactoring? Well, it’s the ability to change the internal structure of your code without changing the external behavior of your code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Code Refactoring has 7 operations; you can use these operations by issuing a right-click in your code IDE. I’ll discuss each of them in detail:&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Extract Method – this operation enables you to create a new method based on the code fragments of your code. Example:&lt;BR&gt;(Just highlight the code between the Extract Method begin and end. Right click, select Refactor-&amp;gt;Extract Method)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;// before the Refactoring “Extract method” applied&lt;BR&gt;private void button1_Click(object sender, EventArgs e) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = length - 1; i &amp;gt;= 0; i--) {&lt;BR&gt;// Extract Method begin&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = 100;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt = new DataTable();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Columns.Add("Col1");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt.Columns.Add("Col1");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataRow dr = dt.NewRow();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = i + 1;&lt;BR&gt;// Extract Method end&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;BR&gt;&amp;nbsp;&lt;BR&gt;// After the Refactoring “Extract method” applied&lt;BR&gt;private void button1_Click(object sender, EventArgs e) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; int x = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = length - 1; i &amp;gt;= 0; i--) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; dt = NewMethod(ref x, i);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P dir=ltr&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;private static DataTable NewMethod(ref int x, int i) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DataTable dt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; x = 100;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt = new DataTable();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt.Columns.Add("Col1");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;dt.Columns.Add("Col1");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;DataRow dr = dt.NewRow();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;x = i + 1;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;return dt;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&amp;nbsp;As you can see, the Refactor operation is smart enough to consider variables in the selected code fragment that has an outside declaration of the code selected. See what happened to the DataTable variable. Since the declaration is outside its scope, it then just made it as a parameter to avoid code-logic changes.&lt;/FONT&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Rename – this operation is more simple than the previous. It just gives you the ability to change a variable (field, class, etc…) name and also change all variables that references to it. For example you have a class Student and you want to rename it as StudentNew, if you’ll do it manually you’ll have to search all of your documents and change the class name. But, if you use the Rename operation, the IDE automatically replaces all occurrences of the class Student and rename it to StudentNew. To use, just highlight the variable name that you want to change, right click, select Refactor-&amp;gt;Rename.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Encapsulate Field – this operation gives you an automated way to create properties of the class by existing local variables or fields. To properly take a grasp of its meaning, Here’s an example:&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;// before the Encapsulate field operation&lt;BR&gt;&amp;nbsp;&amp;nbsp; class RefactoredClass {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public RefactoredClass() { }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*start selection*/ &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _name = "";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*End selection*/&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;// After the Encapsulate field operation&lt;BR&gt;&amp;nbsp;&amp;nbsp; class RefactoredClass {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public RefactoredClass() { }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _name = "";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _name; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { _name = value; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Extract Interface – this gives you the capability to automatically generate interfaces based on an existing class or struct definition. Lets use our RefactoredClass sample: (to use, just highlight the class name and right click, select Refactor-&amp;gt;Extract Interface)&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;// Before the Extract Interface operation&lt;BR&gt;&amp;nbsp;&amp;nbsp; class&amp;nbsp;RefactoredClass {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public RefactoredClass() { }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _name = "";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _name; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { _name = value; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; // Before the Extract Interface operation&lt;BR&gt;&amp;nbsp;&amp;nbsp; class RefactoredClass : CodeSnippets.IRefactoredClass {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public RefactoredClass() { }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _name = "";&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return _name; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { _name = value; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;// Plus, it creates a new File which contains the Interface definition.&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This operation would let you choose what fields or methods to include in the interface.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Promote Local Variable to Parameter – I guess this is self-explanatory. It simply lets you select a local variable and make it a parameter with just a single click.&lt;/FONT&gt; 
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Remove Parameters – This also is self-explanatory. It simply provides you with a dialogbox to remove parameters:&lt;/FONT&gt; &lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;IMG height=300 src="/photos/pauldomag/images/88821/original.aspx" width=441&gt; &lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;Reorder Parameters – this is just like the remove parameters operation. It also gives you an interface to reorder your paramters in a method:&lt;/FONT&gt; &lt;/LI&gt;&lt;/UL&gt;&lt;IMG height=330 src="/photos/pauldomag/images/88822/original.aspx" width=468&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This feature is indeed very useful and could boost your programming time just like code snippets. These Refactoring operations that are being introduced would lessen the chance of bugs appearing whenever we want to reorganize our code. So I guess it’s a very good practice to make use of these tools whenever you want to clean-out your code…&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=88823" width="1" height="1"&gt;</description></item><item><title>Creating Code Snippets</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/03/26/87917.aspx</link><pubDate>Sun, 26 Mar 2006 20:01:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:87917</guid><dc:creator>Paul June</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=87917</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/03/26/87917.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;My previous blog entry discusses the essentials on using Code Snippets to speed up your development. But as you would have noticed, not all snippets that are available would cater to your needs.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In this scenario, you must create your own Code Snippets Library so that you can have snippets which are greatly customized for your development.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Here I will discuss creating custom snippets.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;How does a snippet work? Well, this is the first question that we need to answer to fully understand the background processing that’s happening on code snippets. Code snippets are just xml’s. There is a proper format for you to follow. Here’s a sample code snippet:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;BR&gt;&amp;lt;CodeSnippet Format="1.0.0"&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Header&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Title&amp;gt;class&amp;lt;/Title&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Shortcut&amp;gt;class&amp;lt;/Shortcut&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Description&amp;gt;Expansion snippet for class&amp;lt;/Description&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SnippetTypes&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SnippetType&amp;gt;Expansion&amp;lt;/SnippetType&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;SnippetType&amp;gt;SurroundsWith&amp;lt;/SnippetType&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/SnippetTypes&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Header&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;Snippet&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Declarations&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Literal default="true"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ID&amp;gt;name&amp;lt;/ID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ToolTip&amp;gt;Class name&amp;lt;/ToolTip&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Default&amp;gt;MyClass&amp;lt;/Default&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Literal&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Declarations&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Code Language="csharp" Format="CData"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;![CDATA[class $name$&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $selected$$end$&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }]]&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/Code&amp;gt;&lt;BR&gt;&amp;nbsp; &amp;lt;/Snippet&amp;gt;&lt;BR&gt;&amp;lt;/CodeSnippet&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Let’s digest this sample bit by bit. The root element of a code snippet is the &amp;lt;CodeSnippet&amp;gt; tag. All declarations on your snippet must reside between the &amp;lt;CodeSnippet&amp;gt; tag. The &amp;lt;CodeSnippet&amp;gt; tag has two-key sub-elements. These are the &amp;lt;Header&amp;gt; and the &amp;lt;Snippet&amp;gt; tag. The &amp;lt;Header&amp;gt; tag contains the information of the snippet that is needed by the IDE. In our example it contains four tags:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana size=2&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;lt;Title&amp;gt; – the title of the code snippet. 
&lt;LI&gt;&amp;lt;Shortcut&amp;gt; - defines the shortcut of the class. 
&lt;UL&gt;
&lt;LI&gt;I kinda forgot to mention that you can directly type a shortcut for the code snippet and press tab to automatically insert it in your code.&lt;/LI&gt;&lt;/UL&gt;
&lt;LI&gt;&amp;lt;Description&amp;gt; - A proper description of your code snippet. It will be displayed when you browse your snippet in the intellisense. 
&lt;LI&gt;&amp;lt;SnippetTypes&amp;gt; - specifies which category your snippet would appear. It could have up to three values. Expansion, SurroundsWith or Refractoring. A snippet could be in all of the three categories.&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The &amp;lt;Snippet&amp;gt; tag is a little bit more complicated. This is where you’ll define your parameters and the code snippet itself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The &amp;lt;Snippet&amp;gt; tag has two sub-elements. These are:&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face=Verdana size=2&gt;
&lt;UL&gt;
&lt;LI&gt;&amp;lt;Declarations&amp;gt; - contains the editable or user-specified variables in the snippet. In the example:&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;FONT face="Courier New" color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Declarations&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Literal default="true"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ID&amp;gt;name&amp;lt;/ID&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;ToolTip&amp;gt;Class name&amp;lt;/ToolTip&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;Default&amp;gt;MyClass&amp;lt;/Default&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Literal&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/Declarations&amp;gt;&lt;BR&gt;&lt;/FONT&gt;&amp;nbsp;&lt;BR&gt;The snippet contains one parameter which is the “Class name”. You can specify as many parameters as you want.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;FONT face=Verdana size=2&gt;&amp;lt;Code&amp;gt; - this tag contains the specific code to insert. Let’s see the example:&lt;/FONT&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;BLOCKQUOTE dir=ltr&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#0000ff size=2&gt;&amp;nbsp;&amp;nbsp; &amp;lt;Code Language="csharp" Format="CData"&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;![CDATA[class $name$&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; $selected$$end$&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }]]&amp;gt;&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/Code&amp;gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;By looking at the code, you’ll notice three different-looking directives. The $name$, $selected$ and $end$. The $name$ directive is the ID of the parameter that you declared in the &amp;lt;Declarations&amp;gt; tag. This will tell the IDE that this is the place where the user must specify a value. The $selected$ directive represents the code that was selected prior to the insertion of the code snippet. This is pretty useful if your snippet will supports “SurroundsWith”. Lastly the $end$ directive is where your cursor would be located after the insertion of the code snippet.&lt;/FONT&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;By now, you can already create your own code snippet file. But how would you load it in Visual Studio?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;You can register your snippets by directly copying your file to the default location of all code snippets (C:\Program Files\Microsoft Visual Studio 8\VC#\Snippets\1033\Visual C#).&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;But, if you want to create you own library then you’ll have to use the Code Snippet Manager (Tools-&amp;gt;Code Snippet Manager). You can specify which folder the IDE would look for code snippets.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG height=376 src="/photos/pauldomag/images/87916/original.aspx" width=470&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;BR&gt;Now that you have learned how to create code snippets, I would greatly advise to make use of this feature. It will definitely boost up your programming speed.&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=87917" width="1" height="1"&gt;</description></item><item><title>Using Code Snippets</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/03/25/87791.aspx</link><pubDate>Sat, 25 Mar 2006 17:54:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:87791</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=87791</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/03/25/87791.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Visual Studio 2005 offers a great IDE for improving your coding speeds. One if the feature that would definitely boost your speed up is the Code Snippet.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Code Snippets are pieces of code that you can automatically insert in your source code to avoid redundant coding.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;To insert code snippets on your code, simply right-click on the editor and choose insert snippet.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87784/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;You will then be prompted to choose from the library of snippets that you have. If you’re asking on how you could create your own directory of snippets, I’ll be discussing it&amp;nbsp;on a seperate&amp;nbsp;article.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87785/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;After choosing the snippet library you will then get the list of available snippets for that library. &lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;Lets try selecting the “for” snippet.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87786/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;By selecting a snippet, a code then is automatically generated. Plus the generated code would highlight the thing that needs editing.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Another cool feature of code snippets is its ability to wrap your code with a snippet. For example you have this code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;DataTable dt = new DataTable();&lt;BR&gt;dt.Columns.Add("Col1");&lt;BR&gt;dt.Columns.Add("Col1");&lt;BR&gt;DataRow dr = dt.NewRow();&lt;BR&gt;...&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;And then you realize that you must place this in a reverse for-loop. You can do it easily by using “Surround With”. To do this, j&lt;/FONT&gt;&lt;FONT face=Verdana size=2&gt;ust highlight the code, then right click and select “Surround With”&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87788/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Just like using code-snippets, you’ll also be prompted to select the code-snippet to wrap this code.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87789/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Let’s try selecting a reverse for-loop.&lt;/FONT&gt;&lt;/P&gt;&lt;IMG src="/photos/pauldomag/images/87790/original.aspx"&gt; 
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Voila! Your code now is wrapped with a reverse for-loop statement.&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=87791" width="1" height="1"&gt;</description></item><item><title>Indexers</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/03/23/87480.aspx</link><pubDate>Thu, 23 Mar 2006 15:33:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:87480</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=87480</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/03/23/87480.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I had just a run-in-review with this feature when my friend asked me how to enable your class to contain “angle bars []” to return a value from his class, much like an array. Well, the proper way of doing this is to use Indexers in your class. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Indexers works internally like a property. You need to specify its get and set routines to retrieve and give values to your indexed class. Here’s a sample to give you a clearer image on what I’m saying:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;class IndexerClass{&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private int[] arr = new int[100];&lt;BR&gt;&lt;EM&gt;&lt;FONT color=#0000ff&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int this[int index]&amp;nbsp;&amp;nbsp; // Indexer declaration {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Check the index limits.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (index &amp;lt; 0 || index &amp;gt;= 100) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } else {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return arr[index];&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } set {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!(index &amp;lt; 0 || index &amp;gt;= 100)) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; arr[index] = value;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&lt;/FONT&gt;&lt;/EM&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;class MainClass {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; static void Main() {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IndexerClass test = new IndexerClass();&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Call the indexer to initialize the elements #3 and #5.&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test[3] = 256;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; test[5] = 1024;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (int i = 0; i &amp;lt;= 10; i++) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine("Element #{0} = {1}", i, test[i]);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=1&gt;&lt;EM&gt;Note: sample taken from the MSDN documentation.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The highlighted text in the sample shows you how you declare an Index in your class. It’s pretty quite self-explanatory. For reasons of to be able to make this blog longer, I’ll explain some bits on the code.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The first you’ll notice is the use of the &lt;STRONG&gt;this &lt;/STRONG&gt;keyword. The this keyword indicates the current class that you are in, you must use the this keyword to specify a property-like index in your class. The second is the angle brackets, here you’ll specify the index itself. In the example, it uses an integer as an index. Well, virtually you can specify any type that you want inside your index. It can be a string or a double. The third part that you’ll notice is the get and set routine. As I explained earlier it works just like a property. The get routine specifies whenever the user gets the value of your index. The set routine enables you to trap whenever the user gives a value to your index. In your set routine, you would notice another keyword, the &lt;STRONG&gt;value&lt;/STRONG&gt; keyword. This variable contains the value that the user is giving to your indexed class. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;indexerClass[0] = “test” // the value variable would contain “test”&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Well I guess that’s all the essential part of indexed class.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;You might be wondering on what practical use indexed class would be. Well, for starters, it would be very useful if you would have dynamic properties. Instead of exposing a getValue() function, its more readable and easier if you’ll provide an index to your class. A perfect example of this is the DataReader and DataRow class of ADO .Net. It uses indexes to access values in your fields in a row in the database.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;SqlDataReader reader = command.ExecuteReader();&lt;BR&gt;int empId = (int) reader[“Id”];&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Happy Indexing!&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=87480" width="1" height="1"&gt;</description></item><item><title>Previewing LinQ</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/03/20/87037.aspx</link><pubDate>Mon, 20 Mar 2006 18:45:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:87037</guid><dc:creator>Paul June</dc:creator><slash:comments>1</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=87037</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/03/20/87037.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Just today, I tried previewing the LinQ project. If anyone of doesn’t know what the LinQ project is, it’s a new set of API’s to enable enhanced querying that is embedded to your code. LinQ stands for Language Integrated Query.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The first preview was made available to the public on last PDC 2005. Yet, I was able to see some demos lately. And this triggered mw to preview it myself.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Installing LinQ requires that you have Visual Studio 2005 or Express installed in your machine. And also since its part of the Visual Studio Orcas then you also have to download the WinFx Runtimes.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;A href="http://msdn.microsoft.com/vstudio/express/"&gt;Visual Studio Express&lt;/A&gt;&lt;BR&gt;&lt;A href="http://download.microsoft.com/download/4/7/0/4703eba2-78c4-4b09-8912-69f6c38d3a56/LINQ%20Preview.msi"&gt;WinFx Runtime&lt;BR&gt;LinQ Preview&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Upon installing don’t forget to read the ReadMe.Htm the document contains a shortcut for the installer to integrate LinQ in VS2005’s intellisense.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Upon creating a new project in VStudio, you’ll have a new type of project called LinQ Preview.&lt;a href="http://msmvps.com/photos/pauldomag/images/87036/original.aspx"&gt;&lt;IMG height=203 src="/photos/pauldomag/images/87036/original.aspx" width=441&gt;&lt;/A&gt;&lt;BR&gt;&lt;BR&gt;It’s getting cooler than cool!&lt;BR&gt;I’ve created a new LinQ Windows Application project.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;There have been several samples to guide me. Well as I have seen, my assessment so far was that the LinQ project was designed to perform SQL-based queries on your Array, List and Dictionary. So far I have created this sample code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;//Here’s my class&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public class Employee {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public Employee() {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Name = "";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string City = "";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public string Id = "";&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public int Age = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;// Here’s where I used LinQ&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;List&amp;lt;Employee&amp;gt; employees = GetEmployees(); &lt;BR&gt;// this function returns a List of employees &lt;BR&gt;var res = &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; from n in employees&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; where n.Age &amp;gt; 20&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; select n;&lt;BR&gt;foreach(var x in res) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(x.Name);&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In my example, what I did was create a simple where query to get all employees in my list with an age greater that 20. Hmmm.. Never thought I could do that! Awesome!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Well, that’s not all you can do. You can perform sum, avg and other sql-based queries to your list or array. And before I forgot, all of your array, list or Dictionary now has addition LinQ specific properties such as where&amp;lt;&amp;gt;. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;int[] arr_int = new int[] { 1, 2, 3, 4, 5 };&lt;BR&gt;var res = arr_int.Where(n =&amp;gt; n &amp;gt; 2);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;The statement queries the array of integer for values less than 2. So as you can see LinQ can be very flexible. It can be used as a sql statement or as a method of an object.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Another useful capability of LinQ is the ability to query by object type. Here’s a sample:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;object[] obj = new object[]{ "1", 1, 2, "x", 4 };&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;var i = obj.OfType&amp;lt;int&amp;gt;();&lt;BR&gt;foreach(var x in i) {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; MessageBox.Show(x.ToString());&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This routine would query all integer values only excluding all values with quotes. Ain’t that cute?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Although LinQ is very impressive, it still has its limitations. You can only use it with List, Array and Dictionary. But what about DataAccess? Well, I thought that it has no capabilities. For when I tried LinQ against the Row property of DataTable it sadly failed. But alas! There’s another component that handles data thru LinQ. Its called DLinq. Its another new approach to data access. Not its not a replacement for ADO.Net. Its just another way. DLinq is also a member of the ADO.Net family. And yes, you can interoperate with it. Here’s a sample code that I did using DLinq:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;// This is the class I’m using to store tables&lt;BR&gt;[Table(Name="Customers")]&lt;BR&gt;public class Customer&lt;BR&gt;{&lt;BR&gt;&amp;nbsp;[Column(Id=true)] // specify that the column is a primary key&lt;BR&gt;&amp;nbsp;public string CustomerID;&lt;BR&gt;&amp;nbsp;[Column] // a normal column&lt;BR&gt;&amp;nbsp;public string City;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;DataContext db = new DataContext(@"c:\employee.mdf"); &lt;BR&gt;// the parameter could also contain a connection string&lt;BR&gt;// Retrieve a table&lt;BR&gt;Table&amp;lt;Customer&amp;gt; Customers = db.GetTable&amp;lt;Customer&amp;gt;();&lt;BR&gt;// Query for customers from Davao&lt;BR&gt;var q =&lt;BR&gt;&amp;nbsp;from c in Customers&lt;BR&gt;&amp;nbsp;where c.City == "Davao"&lt;BR&gt;&amp;nbsp;select c;&lt;BR&gt;foreach (var cust in q)&lt;BR&gt;&amp;nbsp;Console.WriteLine("id = {0}, City = {1}", cust.CustomerID, cust.City);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I think I would not go deeply here. I just wanted to show you the new capabilities of DLinq. There's also another subset in LinQ its called XLinq. It is to be used on Xml's. But I think I'll indulge on that one when I have the time. But for now, I think that this is enough to get you drooling just like me!&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I’ve only tried a little bit of everything here. And I’m quite sure that LinQ would continue to be enhanced. The feature that I missed though was DataBinding. You can’t Databind these objects. But Microsoft said that databinding would be available. Hmm.. can’t wait to get my hands on Orcas!&lt;BR&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=87037" width="1" height="1"&gt;</description></item><item><title>Serialization</title><link>http://msmvps.com/blogs/pauldomag/archive/2006/03/17/86719.aspx</link><pubDate>Fri, 17 Mar 2006 19:26:00 GMT</pubDate><guid isPermaLink="false">d67277c4-116b-43f1-b688-e9ef184ea916:86719</guid><dc:creator>Paul June</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://msmvps.com/blogs/pauldomag/rsscomments.aspx?PostID=86719</wfw:commentRss><comments>http://msmvps.com/blogs/pauldomag/archive/2006/03/17/86719.aspx#comments</comments><description>&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I know that this is an old age technology in .Net. But I was surprised that some C# programmers still don’t know about serialization. So I’m creating this blog for the ones who still hasn’t got any idea on serialization. But if you already know this, then just skip this blog entry.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;Here’s a FAQ about serialization.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;What is serialization?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;Well, according to MSDN, “as the process of storing the state of an object instance to a storage medium”. So why do we need to store a class in an external storage? The reason for this is that, sometimes we need to communicate across between applications. And sometimes, it’s a lot easier if we can pass objects between two separate application domains.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;Why use serialization?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;Just like as said earlier, sometimes when you need to pass objects between two applications, you can’t pass it through memory coz two different applications resides in two different domains. So you must find a way to store it externally so that the other application could read the external file and recreate your class.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;How do you serialize a class?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;All you have to do is mark your class as serializable. To do this just place the serializable keyword enclosed in angle bars before the declaration of your class:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;[Serializable]&lt;BR&gt;public class MyObject {&lt;BR&gt;&amp;nbsp;&amp;nbsp; public int n1 = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp; public int n2 = 0;&lt;BR&gt;&amp;nbsp;&amp;nbsp; public String str = null;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This is the basic serializable class. When you serialize the class. All of its private and public properties would also be saved. Now, to serialize a class, you must have a serializer. To explain it better, Here’s an example:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;MyObject obj = new MyObject();&lt;BR&gt;obj.n1 = 1;&lt;BR&gt;obj.n2 = 24;&lt;BR&gt;obj.str = "Some String";&lt;BR&gt;IFormatter formatter = new BinaryFormatter();&lt;BR&gt;Stream stream = new FileStream("MyFile.bin", &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileMode.Create, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileAccess.Write, FileShare.None);&lt;BR&gt;formatter.Serialize(stream, obj);&lt;BR&gt;stream.Close();&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This sample writes your class into a File names “MyFile.bin”.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;After serializing, what should I do?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;After serializing the class, you should deserialize it for you to restore the state of the saved class. Here’s a sample:&lt;BR&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;IFormatter formatter = new BinaryFormatter();&lt;BR&gt;Stream stream = new FileStream("MyFile.bin", &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileMode.Open, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileAccess.Read, &lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FileShare.Read);&lt;BR&gt;MyObject obj = (MyObject) formatter.Deserialize(fromStream);&lt;BR&gt;stream.Close();&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;// Here's the proof&lt;BR&gt;Console.WriteLine("n1: {0}", obj.n1);&lt;BR&gt;Console.WriteLine("n2: {0}", obj.n2);&lt;BR&gt;Console.WriteLine("str: {0}", obj.str);&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;In the previous example, we are using the BinaryFormatter as the serializer for our class. The BinaryFormatter class serializes our class into a file. But its pretty useful to serialize our class into an xml stream. This is the case of Webservices. To serialize a class into an xml stream, you’ll have to use the SoapFormatter instead of BinaryFormatter. &lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;What if I don’t like to include some properties during serialization?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;To exclude some properties, just mark them as NonSerialized. Here’s a sample:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" color=#000000 size=2&gt;&lt;STRONG&gt;[Serializable]&lt;BR&gt;public class MyObject &lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; public int n1;&lt;BR&gt;&amp;nbsp;&amp;nbsp; [NonSerialized] public int n2;&lt;BR&gt;&amp;nbsp;&amp;nbsp; public String str;&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;This process is called Selective Serialization.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;What about the ISerializable Interface?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;The ISerializable interface is used when your doing Custom Serialization. Wondering what difference it is compared to Selective Serialization? Well, when your class is implementing the ISerializable interface, you will have the power to set values to your variables during serialization. This is pretty much useful when a value in your class would be invalid after deserialization, but you need to initialize its value. You must be also wondering if why not just place the initialization code in your constructor? The answer is simple, during deserialization your constructor would not be called. So how to implement ISerializable? Here’s a sample:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;Serializable]&lt;BR&gt;public class MyObject : ISerializable &lt;BR&gt;{&lt;BR&gt;&amp;nbsp;&amp;nbsp; public int n1;&lt;BR&gt;&amp;nbsp;&amp;nbsp; public int n2;&lt;BR&gt;&amp;nbsp;&amp;nbsp; public String str;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; public MyObject()&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; protected MyObject(SerializationInfo info, StreamingContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n1 = info.GetInt32("i");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; n2 = info.GetInt32("j");&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; str = info.GetString("k");&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New" size=2&gt;&lt;STRONG&gt;&amp;nbsp;&amp;nbsp; public virtual void GetObjectData(SerializationInfo info, &lt;BR&gt;StreamingContext context)&lt;BR&gt;&amp;nbsp;&amp;nbsp; {&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info.AddValue("i", n1);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info.AddValue("j", n2);&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; info.AddValue("k", str);&lt;BR&gt;&amp;nbsp;&amp;nbsp; }&lt;BR&gt;}&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;There are two things to consider when implementing the ISerializable interface. You should implement a special constructor which happens during deserialization. And also the GetObjectData method, this method is called during the serialization process.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;&lt;STRONG&gt;&lt;EM&gt;When should I use Serialization?&lt;/EM&gt;&lt;/STRONG&gt;&lt;BR&gt;A straightforward answer, always. You should mark your classes serializable as often as possible. Coz you might not know that the user of your class might design to inherit your class and serialize it. Hmmm. I kinda forgot to say that you cannot serialize an object if the base class is not serializable. Sorry for that.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;So during your design phase, you should identify the classes that you think its users would serialize. To be safe, you can mark all of your class into serializables.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face=Verdana size=2&gt;I hope this clarifies any issue about serialization. Cheers!&lt;BR&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://msmvps.com/aggbug.aspx?PostID=86719" width="1" height="1"&gt;</description><category domain="http://msmvps.com/blogs/pauldomag/archive/tags/Programming/default.aspx">Programming</category></item></channel></rss>