<?xml version="1.0" encoding="UTF-8"?> <rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Fundamental Provocation &#187; Tip of Week</title> <atom:link href="http://www.ajaymatharu.com/tag/tip-of-week/feed/" rel="self" type="application/rss+xml" /><link>http://www.ajaymatharu.com</link> <description>Blog by Ajay Matharu</description> <lastBuildDate>Sun, 06 Nov 2011 15:09:39 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>Add an existing file to a project without copying it</title><link>http://www.ajaymatharu.com/add-an-existing-file-to-a-project-without-copying-it/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=add-an-existing-file-to-a-project-without-copying-it</link> <comments>http://www.ajaymatharu.com/add-an-existing-file-to-a-project-without-copying-it/#comments</comments> <pubDate>Mon, 25 May 2009 03:52:47 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Visual Studio tips]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=272</guid> <description><![CDATA[If you want to add an existing file to a project and have the project point to the file where it resides, press the little arrow key on the right side of the add button on the add existing dialog.  The arrow will present a small context menu that allows the option of adding the [...]]]></description> <content:encoded><![CDATA[<p>If you want to add an existing file to a project and have the project point to the file where it resides, press the little arrow key on the right side of the add button on the add existing dialog.  The arrow will present a small context menu that allows the option of adding the file as a link, which will cause the Visual Studio project to point to that file where it is instead of copying it to the project directory.</p><p><a href="http://ajaymatharu.files.wordpress.com/2008/10/existing.png"><img class="aligncenter size-full wp-image-273" title="existing" src="http://ajaymatharu.files.wordpress.com/2008/10/existing.png" alt="" width="450" height="327" /></a></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/add-an-existing-file-to-a-project-without-copying-it/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Find Window in Visual Studio &#8211; Visual Studio Tip of Week #18</title><link>http://www.ajaymatharu.com/find-window-in-visual-studio-visual-studio-tip-of-week-18/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=find-window-in-visual-studio-visual-studio-tip-of-week-18</link> <comments>http://www.ajaymatharu.com/find-window-in-visual-studio-visual-studio-tip-of-week-18/#comments</comments> <pubDate>Mon, 19 Jan 2009 04:08:30 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Find]]></category> <category><![CDATA[Find window]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=793</guid> <description><![CDATA[Normally when you use &#8220;ctrl + f&#8221; and search for results, you have to navigate one by one in every file where the searched string exists. There is an alternative to this rather than navigating one by one you can have all the results in your &#8220;find window&#8221;. press ctrl + shft + f you [...]]]></description> <content:encoded><![CDATA[<p>Normally when you use &#8220;ctrl + f&#8221; and search for results, you have to navigate one by one in every file where the searched string exists. There is an alternative to this rather than navigating one by one you can have all the results in your &#8220;find window&#8221;.</p><p>press ctrl + shft + f</p><p><img class="aligncenter size-full wp-image-794" title="find" src="http://ajaymatharu.files.wordpress.com/2009/01/find.jpg" alt="find" width="346" height="487" /></p><p>you can search for the string and the result will be displayed in the Find window</p><p><img class="aligncenter size-full wp-image-797" title="find-result2" src="http://ajaymatharu.files.wordpress.com/2009/01/find-result2.jpg" alt="find-result2" width="500" height="207" /></p><p>you can click on the search result line to navigate to that part.</p><p>This is extremely helpful when you want all your results to be listed in a find window rather then to navigate one by one in every file where the searched string exists.</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/find-window-in-visual-studio-visual-studio-tip-of-week-18/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Navigate To and From function() &#8211; Visual Stuido Tip of Week #17</title><link>http://www.ajaymatharu.com/navigate-to-from-function-visual-stuido-tip-of-week-17/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=navigate-to-from-function-visual-stuido-tip-of-week-17</link> <comments>http://www.ajaymatharu.com/navigate-to-from-function-visual-stuido-tip-of-week-17/#comments</comments> <pubDate>Mon, 12 Jan 2009 00:00:46 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Function navigation]]></category> <category><![CDATA[To and From Function()]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=787</guid> <description><![CDATA[Many a times you find the need to navigate to the function definition from the function call to see how the function has been defined. To do this you can either press F12 or right click on function call and select &#8220;Go to definition&#8221; option. Similarly from the function definition to go back to the [...]]]></description> <content:encoded><![CDATA[<p>Many a times you find the need to navigate to the function definition from the function call to see how the function has been defined. To do this you can either press F12 or right click on function call and select &#8220;Go to definition&#8221; option.</p><p><img class="aligncenter size-full wp-image-788" title="function-definition" src="http://ajaymatharu.files.wordpress.com/2009/01/function-definition.jpg" alt="function-definition" width="469" height="254" /></p><p>Similarly from the function definition to go back to the function call press      ctrl + &#8211; keys.</p><p><img class="aligncenter size-full wp-image-789" title="backtofunctioncall" src="http://ajaymatharu.files.wordpress.com/2009/01/backtofunctioncall.jpg" alt="backtofunctioncall" width="468" height="186" /></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/navigate-to-from-function-visual-stuido-tip-of-week-17/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>RexEx Search &#8211; Tip of Week #16</title><link>http://www.ajaymatharu.com/rexex-search-tip-of-week-16/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rexex-search-tip-of-week-16</link> <comments>http://www.ajaymatharu.com/rexex-search-tip-of-week-16/#comments</comments> <pubDate>Mon, 05 Jan 2009 00:00:02 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=743</guid> <description><![CDATA[Regular expressions are an extremely versatile text-matching language that gives you incredible power when searching your documents and when used with replace operations, can greatly assist with repetitive changes to blocks of code. The basic regular expression search is easily done. You simply open the Find dialog through the Edit &#8211; Find and Replace &#8211; [...]]]></description> <content:encoded><![CDATA[<p>Regular expressions are an extremely versatile text-matching  language that gives you incredible power when searching your documents and when  used with replace operations, can greatly assist with repetitive changes to  blocks of code.</p><p><img class="aligncenter size-full wp-image-744" title="regex" src="http://ajaymatharu.files.wordpress.com/2009/01/regex.jpg" alt="regex" width="251" height="273" /></p><p>The basic regular expression search  is easily done. You simply open the Find dialog through the Edit &#8211; Find and Replace &#8211; Find menu or with Ctrl-F (Edit.Find).  Enable regular expression searching by ensuring the Use checkbox is selected and  the drop-down list has Regular Expressions selected.</p><p>Enter your regular expression into the Find What text box and click on Find  Next. The next match of your expression will be found in the document. As with  normal matches, clicking Find Next again will find the next match. The next step  is to learn the regular expression (also known as <span class="docEmphasis">regex</span> or <span class="docEmphasis">regexp</span>) syntax.</p><p class="docText"><strong>Regular  expressions</strong> :</p><p class="docText">Regular  expressions<strong> </strong>can be very complex, but basic expressions can be easy to master.  Unlike normal searches, regular expressions designate a pattern of characters to  match instead of a constant string. For example, square brackets in a regular  expression define a set of characters (a <span class="docEmphasis">character  class</span>). When you execute the search, it  will match any one character out of the set of characters inside the brackets,  so the expression <tt>[abcd]</tt> would match <em>a</em>, <em>b</em>, <em>c</em>, and <em>d</em>—but not <em>z</em>. You can also specify character ranges inside the  brackets, so <tt>[a-d]</tt> is equivalent to the expression <tt>[abcd]</tt>. If  you need to specify more than one range, simply add it to the first, so <tt>[a-z0-9]</tt> will match any letter or number. Regular expression characters  in Visual Studio are not case  sensitive unless you select the Match Case option in the Find dialog. This is a  departure from most other regular expression syntax.</p><p class="docText">Normal alphabetic characters outside of  special expressions match characters literally, similar to a normal Find, but  can be combined with regular expressions to make them more flexible. This means  that combining the set match with a literal match gives us a pattern such as <tt>var[12]</tt>, which will match <tt>var1</tt> and <tt>var2</tt> but not <tt>var3</tt>.</p><p class="docText">If you want to match the string <tt>var[12]</tt>, you&#8217;d need to  escape the special characters, as in <tt>var\[12\]</tt>.</p><p class="docText">More <a href="http://regexlib.com/" target="_blank">Regular Expressions</a>.</p><p class="docText"> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/rexex-search-tip-of-week-16/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Insert Code Snippet &#8211; Tip Of Week #15</title><link>http://www.ajaymatharu.com/insert-code-snippet-tip-of-week-15/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=insert-code-snippet-tip-of-week-15</link> <comments>http://www.ajaymatharu.com/insert-code-snippet-tip-of-week-15/#comments</comments> <pubDate>Mon, 29 Dec 2008 05:51:17 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[C#.Net]]></category> <category><![CDATA[Developer]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=693</guid> <description><![CDATA[Hi guys, do you know you can use already ready code inside your visual studio? Yes certainly you can insert code snippets into your code. You can invoke the &#8220;Insert Snippet&#8221; by using shortcut &#8220;ctrl k + ctrl x&#8221;. You can download some of the code snippets from http://msdn.microsoft.com/en-us/vstudio/aa718338.aspx all you need to do is [...]]]></description> <content:encoded><![CDATA[<p>Hi guys, do you know you can use already ready code inside your visual studio? Yes certainly you can insert code snippets into your code. You can invoke the &#8220;Insert Snippet&#8221; by using shortcut &#8220;ctrl k + ctrl x&#8221;.</p><p><img class="aligncenter size-full wp-image-694" title="snippet" src="http://ajaymatharu.files.wordpress.com/2008/12/snippet.jpg" alt="snippet" width="500" height="221" /></p><p>You can download some of the code snippets from http://msdn.microsoft.com/en-us/vstudio/aa718338.aspx  all you need to do is install this file at &#8220;My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets&#8221; location. You can also find some more snippets at  http://www.codeplex.com/snippetlibcsharp/Release/ProjectReleases.aspx?ReleaseId=14841  all you need to do is copy this snippet at &#8220;My Documents\Visual Studio 2008\Code Snippets\Visual C#\My Code Snippets&#8221; and you are ready to use these ready made code into your visual studio using shortcuts &#8220;ctrl k + ctrl x&#8221;</p><p>You can also insert the snippets by writing a part of it and pressing tab twice. For e.g. to insert a new property in your code type</p><p>prop + tab + tab</p><p>this will insert a property in your code window.</p><p>So keep using this to improve your productivity, and enjoy coding.</p><p>:Ajay Matharu</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/insert-code-snippet-tip-of-week-15/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Tasklist Comments / TODO in Visual Studio &#8211; Tip Of Week #14</title><link>http://www.ajaymatharu.com/tasklist-comments-todo-in-visual-studio-tip-of-week-14/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tasklist-comments-todo-in-visual-studio-tip-of-week-14</link> <comments>http://www.ajaymatharu.com/tasklist-comments-todo-in-visual-studio-tip-of-week-14/#comments</comments> <pubDate>Mon, 22 Dec 2008 01:00:05 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Microsoft]]></category> <category><![CDATA[Technology]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=658</guid> <description><![CDATA[Task list comments are a great way to remind you or others of something that still needs to be done or something that may need to be revisited for enhancement. The task list (Ctrl-Alt-K/View.TaskList) is a handy tool that is most often used to view errors or warnings from the compilation of your code. The [...]]]></description> <content:encoded><![CDATA[<p>Task list comments are a great way to remind you or others of something that  still needs to be done or something that may need to be revisited for  enhancement.</p><p>The <a name="visualstudiohks-CHP-3-ITERM-2596"></a><a name="visualstudiohks-CHP-3-ITERM-2597"></a><a name="visualstudiohks-CHP-3-ITERM-2598"></a>task list (<a name="visualstudiohks-CHP-3-ITERM-2599"></a>Ctrl-Alt-K/View.TaskList) is a handy  tool that is most often used to view errors or warnings from the compilation of  your code.</p><p class="docText">The task list also has another use; it can be used to leave  reminders for yourself or other members of your team in comment form.</p><p class="docText">You can use this comment anywhere throughout your code, and they will show up  in the task list when the file with the comment is open.</p><p class="docText"><p class="docText">//</p><p class="docText">// TODO: Add addition logic here</p><p class="docText">//</p><p class="docText"><p class="docText">To list this in your task list first make sure that the task list is configured to show comments, and then you  will see in the task list that this comment has been added as an item.</p><p class="docText">You will see a drop-down list at the top of the task list that lets you  choose what should be displayed in the task list.</p><p class="docText">You can then click on this comment and be taken to the place where you need to  add code.</p><p class="docText">You can use shortcuts to step back and forth between tasks as well. The  View.NextTask (<a name="visualstudiohks-CHP-3-ITERM-2607"></a> <a name="visualstudiohks-CHP-3-ITERM-2608"></a>Ctrl-Shift-F12) and  View.PreviousTask<a name="visualstudiohks-CHP-3-ITERM-2609"></a> (no default  shortcut) commands can be used to step through the tasks listed in the task  list.</p><p class="docText">You can also click in the area at the top of the task list with  the <a name="visualstudiohks-CHP-3-ITERM-2610"></a><a name="visualstudiohks-CHP-3-ITERM-2611"></a>text &#8220;Click here to add a new task,&#8221;  or  you can click the Create User Task button. This  creates a user task for you and acts much like the tasks portion of Outlook. You  can also tag any line in your project as a task by using the  Edit.ToggleTaskListShortcut (Ctrl-K, Ctrl-H)<a name="visualstudiohks-CHP-3-ITERM-2612"></a> <a name="visualstudiohks-CHP-3-ITERM-2613"></a>command. Whenever you call this  command, it will add a shortcut to the task list pointing to this line of code.  You can then add text that says what should be done to the line of code. It is a  quick and easy way to add something to the task list to tackle later on. These  tasks will appear only on your system and not on the systems of your team  members.</p><p class="docText"><p class="docText"> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/tasklist-comments-todo-in-visual-studio-tip-of-week-14/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Code Defination Window &#8211; Tip of week #13</title><link>http://www.ajaymatharu.com/code-defination-window-tip-of-week-13/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=code-defination-window-tip-of-week-13</link> <comments>http://www.ajaymatharu.com/code-defination-window-tip-of-week-13/#comments</comments> <pubDate>Mon, 15 Dec 2008 07:00:15 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Technical]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[ASP.Net]]></category> <category><![CDATA[C#.Net]]></category> <category><![CDATA[Code defination window]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=621</guid> <description><![CDATA[There are a few hidden gems in Visual Studio that are easy to overlook. One of those is the Code Definition Window (ctrl+\,ctrl+d or View &#8211; Code Definition Window). The Code Definition Window will work in two different ways. The first is with your current code editing window. As you navigate your code, the Code [...]]]></description> <content:encoded><![CDATA[<p>There are a few hidden gems in Visual Studio that are easy to overlook.  One of those is the Code Definition Window (ctrl+\,ctrl+d or View &#8211; Code Definition Window).</p><p>The Code Definition Window will work in two different ways.  The first is with your current code editing window.  As you navigate your code, the Code Definition Window will display the definition of the objects currently under your cursor.  For instance, if your cursor is currently over a class level variable, the Code  Definition Window will display the location in the source file where the variable is declared.  The same goes for methods and classes both within the current source file and in other source files within your current solution.</p><p>The second way the Code Definition Window can work is in conjunction with the Visual Studio Class View Window (ctrl+shift+c or View &#8211; Class View).  The Class View Window is a handy tool window in its own right, giving a quick overview of the object model of the current solution and allowing fast navigation through namespaces, classes, and methods.  If you double click on a method in the Class View Window, Visual Studio will open the appropriate source code file and scroll to that particular method.  This is quite useful for larger projects and for projects that might have multiple class definitions in each file.  However, if you single click on a method, the contents of that method will show in the Code Definition Window without opening the file in a text editing window.</p><p><img class="aligncenter size-full wp-image-620" title="codeview" src="http://ajaymatharu.files.wordpress.com/2008/12/codeview.jpg" alt="codeview" width="691" height="484" /></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/code-defination-window-tip-of-week-13/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Extract Method &#8211; Tip of week #11</title><link>http://www.ajaymatharu.com/extract-method-tip-of-week-11/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=extract-method-tip-of-week-11</link> <comments>http://www.ajaymatharu.com/extract-method-tip-of-week-11/#comments</comments> <pubDate>Mon, 01 Dec 2008 12:44:23 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Extract Method]]></category> <category><![CDATA[Extract Method in Visual Studio]]></category> <category><![CDATA[Visual Studio Tip]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=494</guid> <description><![CDATA[Refactoring is very essential part of coding. You need to refactor your code, to give optimal result. Visual Studio have an inbuilt option for refactoring your code. Right click &#8211; Refactor, today I am going to talk about Extract Method. Suppose this is my sample code, althogh not good but just to demonstrate.    27 public void [...]]]></description> <content:encoded><![CDATA[<p>Refactoring is very essential part of coding. You need to refactor your code, to give optimal result. Visual Studio have an inbuilt option for refactoring your code. Right click &#8211; Refactor, today I am going to talk about Extract Method.</p><p>Suppose this is my sample code, althogh not good but just to demonstrate.</p><div style="font-family:Courier New;font-size:10pt;color:black;background:white;"><p style="margin:0;"><span style="color:#2b91af;">   27</span> <span style="color:blue;">public</span> <span style="color:blue;">void</span> fillControl()</p><p style="margin:0;"><span style="color:#2b91af;">   28</span>     {</p><p style="margin:0;"><span style="color:#2b91af;">   29</span>         <span style="color:blue;">try</span></p><p style="margin:0;"><span style="color:#2b91af;">   30</span>         {</p><p style="margin:0;"><span style="color:#2b91af;">   31</span>             <span style="color:#2b91af;">OleDbDataAdapter</span> adapter;</p><p style="margin:0;"><span style="color:#2b91af;">   32</span>             <span style="color:#2b91af;">DataSet</span> dataset;</p><p style="margin:0;"><span style="color:#2b91af;">   33</span>             <span style="color:#2b91af;">OleDbConnection</span> conn;</p><p style="margin:0;"><span style="color:#2b91af;">   34</span> </p><p style="margin:0;"><span style="color:#2b91af;">   35</span>             conn = <span style="color:blue;">new</span> <span style="color:#2b91af;">OleDbConnection</span>();</p><p style="margin:0;"><span style="color:#2b91af;">   36</span>             conn.ConnectionString = <span style="color:#a31515;">&#8220;PROVIDER=MICROSOFT.Jet.Oledb.4.0;Data Source=&#8221;</span> + Server.MapPath(<span style="color:#a31515;">&#8220;mydatabase.mdb&#8221;</span>);</p><p style="margin:0;"><span style="color:#2b91af;">   37</span> </p><p style="margin:0;"><span style="color:#2b91af;">   38</span>             <span style="color:blue;">string</span> sqlQuery = <span style="color:#a31515;">&#8220;SELECT * from employee&#8221;</span>;</p><p style="margin:0;"><span style="color:#2b91af;">   39</span>             adapter = <span style="color:blue;">new</span> <span style="color:#2b91af;">OleDbDataAdapter</span>(sqlQuery, conn);</p><p style="margin:0;"><span style="color:#2b91af;">   40</span>             dataset = <span style="color:blue;">new</span> <span style="color:#2b91af;">DataSet</span>();</p><p style="margin:0;"><span style="color:#2b91af;">   41</span>             adapter.Fill(dataset);</p><p style="margin:0;"><span style="color:#2b91af;">   42</span> </p><p style="margin:0;"><span style="color:#2b91af;">   43</span>             datagrid1.DataSource = dataset;</p><p style="margin:0;"><span style="color:#2b91af;">   44</span>             datagrid1.DataBind();</p><p style="margin:0;"><span style="color:#2b91af;">   45</span>         }</p><p style="margin:0;"><span style="color:#2b91af;">   46</span>         <span style="color:blue;">catch</span> (<span style="color:#2b91af;">Exception</span> ex)</p><p style="margin:0;"><span style="color:#2b91af;">   47</span>         {</p><p style="margin:0;"><span style="color:#2b91af;">   48</span>             Response.Write(<span style="color:#a31515;">&#8220;ERROR :: &#8220;</span> + ex.Message);</p><p style="margin:0;"><span style="color:#2b91af;">   49</span>         }</p><p style="margin:0;"><span style="color:#2b91af;">   50</span>     }</p><p style="margin:0;"> </p><p style="margin:0;">In this code you can see there is connection object created. But there may be numerous occasions where I&#8217;ll have to use the connection, so rather than writing this code again at that place, what I&#8217;ll do is just simply select the two lines of connection right click &#8211; refactor &#8211; extract method</p><p style="margin:0;"> </p><p style="margin:0;"><a href="http://ajaymatharu.files.wordpress.com/2008/11/extract-method1.png"></a><a href="http://ajaymatharu.files.wordpress.com/2008/11/extractmethod.jpg"><img class="aligncenter size-full wp-image-497" title="extractmethod" src="http://ajaymatharu.files.wordpress.com/2008/11/extractmethod.jpg" alt="extractmethod" width="500" height="374" /></a><a href="http://ajaymatharu.files.wordpress.com/2008/11/extract-method.png"></a></p></div><p><a href="http://ajaymatharu.files.wordpress.com/2008/11/name.jpg"><img class="aligncenter size-full wp-image-498" title="name" src="http://ajaymatharu.files.wordpress.com/2008/11/name.jpg" alt="name" width="500" height="196" /></a></p><p>After this, all you get is extracted method,</p><div style="font-family:Courier New;font-size:10pt;color:black;background:white;"><p style="margin:0;"><span style="color:#2b91af;">   27</span> <span style="color:blue;">public</span> <span style="color:blue;">void</span> fillControl()</p><p style="margin:0;"><span style="color:#2b91af;">   28</span>     {</p><p style="margin:0;"><span style="color:#2b91af;">   29</span>         <span style="color:blue;">try</span></p><p style="margin:0;"><span style="color:#2b91af;">   30</span>         {</p><p style="margin:0;"><span style="color:#2b91af;">   31</span>             <span style="color:#2b91af;">OleDbDataAdapter</span> adapter;</p><p style="margin:0;"><span style="color:#2b91af;">   32</span>             <span style="color:#2b91af;">DataSet</span> dataset;</p><p style="margin:0;"><span style="color:#2b91af;">   33</span>             <span style="color:#2b91af;">OleDbConnection</span> conn;</p><p style="margin:0;"><span style="color:#2b91af;">   34</span> </p><p style="margin:0;"><span style="color:#2b91af;">   35</span>             conn = ConnectDb();</p><p style="margin:0;"><span style="color:#2b91af;">   36</span> </p><p style="margin:0;"><span style="color:#2b91af;">   37</span>             <span style="color:blue;">string</span> sqlQuery = <span style="color:#a31515;">&#8220;SELECT * from employee&#8221;</span>;</p><p style="margin:0;"><span style="color:#2b91af;">   38</span>             adapter = <span style="color:blue;">new</span> <span style="color:#2b91af;">OleDbDataAdapter</span>(sqlQuery, conn);</p><p style="margin:0;"><span style="color:#2b91af;">   39</span>             dataset = <span style="color:blue;">new</span> <span style="color:#2b91af;">DataSet</span>();</p><p style="margin:0;"><span style="color:#2b91af;">   40</span>             adapter.Fill(dataset);</p><p style="margin:0;"><span style="color:#2b91af;">   41</span> </p><p style="margin:0;"><span style="color:#2b91af;">   42</span>             datagrid1.DataSource = dataset;</p><p style="margin:0;"><span style="color:#2b91af;">   43</span>             datagrid1.DataBind();</p><p style="margin:0;"><span style="color:#2b91af;">   44</span>         }</p><p style="margin:0;"><span style="color:#2b91af;">   45</span>         <span style="color:blue;">catch</span> (<span style="color:#2b91af;">Exception</span> ex)</p><p style="margin:0;"><span style="color:#2b91af;">   46</span>         {</p><p style="margin:0;"><span style="color:#2b91af;">   47</span>             Response.Write(<span style="color:#a31515;">&#8220;ERROR :: &#8220;</span> + ex.Message);</p><p style="margin:0;"><span style="color:#2b91af;">   48</span>         }</p><p style="margin:0;"><span style="color:#2b91af;">   49</span>     }</p><p style="margin:0;"><span style="color:#2b91af;">   50</span> </p><p style="margin:0;"><span style="color:#2b91af;">   51</span>     <span style="color:blue;">private</span> <span style="color:#2b91af;">OleDbConnection</span> ConnectDb()</p><p style="margin:0;"><span style="color:#2b91af;">   52</span>         {</p><p style="margin:0;"><span style="color:#2b91af;">   53</span>         <span style="color:#2b91af;">OleDbConnection</span> conn;</p><p style="margin:0;"><span style="color:#2b91af;">   54</span>         conn = <span style="color:blue;">new</span> <span style="color:#2b91af;">OleDbConnection</span>();</p><p style="margin:0;"><span style="color:#2b91af;">   55</span>         conn.ConnectionString = <span style="color:#a31515;">&#8220;PROVIDER=MICROSOFT.Jet.Oledb.4.0;Data Source=&#8221;</span> + Server.MapPath(<span style="color:#a31515;">&#8220;mydatabase.mdb&#8221;</span>);</p><p style="margin:0;"><span style="color:#2b91af;">   56</span>         <span style="color:blue;">return</span> conn;</p><p style="margin:0;"><span style="color:#2b91af;">   57</span>         }</p><p style="margin:0;"> </p><p style="margin:0;">So now you can use this ConnectDb() function where ever you need to use the Database connection.</p></div> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/extract-method-tip-of-week-11/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Text editor options &#8211; Tip of week #10</title><link>http://www.ajaymatharu.com/text-editor-options-tip-of-week-10/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=text-editor-options-tip-of-week-10</link> <comments>http://www.ajaymatharu.com/text-editor-options-tip-of-week-10/#comments</comments> <pubDate>Mon, 24 Nov 2008 03:32:32 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Development]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Visual Studio Tip Of Week]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=488</guid> <description><![CDATA[Every good developer knows how to use his tools. He knows what can be done, which are the shortcuts, that&#8217;s the sign of good Geek. Knowing your tool is very important to get your work done faster. In Visual Studio you can play around with the editors settings write from setting up your own shortcuts [...]]]></description> <content:encoded><![CDATA[<p><a href="http://ajaymatharu.files.wordpress.com/2008/11/options.png"></a>Every good developer knows how to use his tools. He knows what can be done, which are the shortcuts, that&#8217;s the sign of good Geek. Knowing your tool is very important to get your work done faster.</p><p>In Visual Studio you can play around with the editors settings write from setting up your own shortcuts chaning font color, font size, selection color and many more things.</p><p>You can access the options of the Visual Studio from Tools &#8211; Options,</p><p><img class="aligncenter size-full wp-image-489" title="options" src="http://ajaymatharu.files.wordpress.com/2008/11/options.png" alt="options" width="682" height="371" /></p><p>Some of my favourite settings are Line numbers, Selection color. You can change entire settings of Visual Studio from this Options menu.</p><p><a href="http://ajaymatharu.files.wordpress.com/2008/11/texteditor.png"><img class="aligncenter size-full wp-image-490" title="texteditor" src="http://ajaymatharu.files.wordpress.com/2008/11/texteditor.png" alt="texteditor" width="677" height="414" /></a></p><p>You can see here you can also make changes which are specific to languages, you can use in Visual Studio.</p><p>Of all this my favourite one is the, ability to change inbuilt keyboard shortcuts. Some of the best inbuilt keyboard shortcuts are</p><p>ctrl k + ctrl d = indentation,</p><p>ctrl k + ctrl c = comment</p><p>ctrl k + ctrl u = uncommnet</p><p>ctrl k + ctrl k = toogle bookmark</p><p>and many more. Although you have complete control over these and you can change this as per your convinience.</p><p><a href="http://ajaymatharu.files.wordpress.com/2008/11/shortcuts.png"><img class="aligncenter size-full wp-image-491" title="shortcuts" src="http://ajaymatharu.files.wordpress.com/2008/11/shortcuts.png" alt="shortcuts" width="635" height="389" /></a></p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/text-editor-options-tip-of-week-10/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Debugging asp.net web application &#8211; Tip of week #9</title><link>http://www.ajaymatharu.com/debugging-aspnet-web-application-tip-of-week-9/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=debugging-aspnet-web-application-tip-of-week-9</link> <comments>http://www.ajaymatharu.com/debugging-aspnet-web-application-tip-of-week-9/#comments</comments> <pubDate>Mon, 17 Nov 2008 03:29:11 +0000</pubDate> <dc:creator>Ajay Matharu</dc:creator> <category><![CDATA[.Net]]></category> <category><![CDATA[Tip of Week]]></category> <category><![CDATA[Visual Studio]]></category> <category><![CDATA[Visual Studio tips]]></category> <category><![CDATA[vs.net]]></category><guid isPermaLink="false">http://ajaymatharu.wordpress.com/?p=276</guid> <description><![CDATA[Hi, Many a times we find it difficult to debug big applications. If we run the application it takes too much time to build and then run the application. Also at times it becomes difficult when you have to debug a code and you can not run the application because some other part of code [...]]]></description> <content:encoded><![CDATA[<p>Hi, Many a times we find it difficult to debug big applications. If we run the application it takes too much time to build and then run the application. Also at times it becomes difficult when you have to debug a code and you can not run the application because some other part of code is errorneous. How to debug the application or code in this scenario?</p><p>You can open the page in the browser by right click on the page in the IDE - View in browser or directly open the page in the browser by URL.</p><p>Go to IDE &#8211; Tools &#8211; Attatch to process or (ctrl + alt + P)</p><p><a href="http://ajaymatharu.files.wordpress.com/2008/10/attach.png"><img class="aligncenter size-full wp-image-277" title="attach" src="http://ajaymatharu.files.wordpress.com/2008/10/attach.png" alt="" width="450" height="286" /></a></p><p>check on both the check boxes at the bottom and select the process W3WP in Windows Server 2003 and ASPNETWP in Windows XP and Windows server 2000.</p><p>Refresh the page the breakpoint will hit and you can debug the application</p> ]]></content:encoded> <wfw:commentRss>http://www.ajaymatharu.com/debugging-aspnet-web-application-tip-of-week-9/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> </channel> </rss>
