.NET Tips & Tricks Community Every .NET practitioner has a trick up in their sleeve. This is the place to share it with other .NET people. http://dotnettipoftheday.org/community http://backend.userland.com/rss RSS.NET: http://www.rssdotnet.com/ How to register a .NET Assembly without using gacutil <p>If&nbsp;the target machine does&nbsp;not have gacutil.exe (for example if SDK is not installed) doing a .NET script to do the same is very easy.</p> <p>- Add reference to System.EnterpriseServices assembly and</p> <pre class="c"><span style="color: #808080; font-style: italic;"><div style="font-family:Courier New; font-size:10pt; color:#000000"><p style="margin: 0px;"><span style="color: #0000ff;">using</span> System.EnterpriseServices.Internal; </p><p style="margin: 0px;">... </p><p style="margin: 0px;">Publish p = <span style="color: #0000ff;">new</span> Publish(); </p><p style="margin: 0px;"><span style="color: #008200;">// for GAC Installation </span></p><p style="margin: 0px;">p.GacInstall(file); <span style="color: #008200;">// for gac installation </span></p><p style="margin: 0px;">... </p><p style="margin: 0px;">p.GacRemove(file); <span style="color: #008200;">// for gac removing </span></p><p style="margin: 0px;">... </p><p style="margin: 0px;">p.RegisterAssembly(file); <span style="color: #008200;">// for registering assembly for interop </span></p><p style="margin: 0px;">... </p><p style="margin: 0px;">p.UnRegisterAssembly(file); <span style="color: #008200;">// to unregister assembly</span></p></div></span></pre> <p>Carefull thow on Vista you should probably try running the program as an Administrator</p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">sharpoverride</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Ge5Ixj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Ge5Ixj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=nro2nJ"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=nro2nJ" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wGe9mj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wGe9mj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=5EUdpj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=5EUdpj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=GEGfiJ"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=GEGfiJ" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=5rYlwj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=5rYlwj" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/330484415" height="1" width="1"/> http://dotnettipoftheday.org/tips/how-to-register-a-net-assembly-without-using-gacutil.aspx Wed, 09 Jul 2008 09:24:32 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=how-to-register-a-net-assembly-without-using-gacutil Why DotNetTipOfTheDay can lick my balls (a memo): <p>I think it is safe to say this website sucks ass.</p> <p>Practically two months without an update when people have been submitting things for you to post.</p> <p>I am pretty lazy when it comes to a lot of things, and up until today have kept your shitty RSS feed in my reader in hopes that you would actully update the site some day.</p> <p>But you suck and I hope your website bombs.&nbsp;</p> <p>Burn in hell.</p> <p>-thiswebsitesuck</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://dotnettipofthedayblowsass.com" style="font-weight:bold">thiswebsitesucks</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Z9MXxj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Z9MXxj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ZUGd3J"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ZUGd3J" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=j7mMdj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=j7mMdj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Z6IAej"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Z6IAej" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=bPrSmJ"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=bPrSmJ" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=6r9rdj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=6r9rdj" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/325822939" height="1" width="1"/> http://dotnettipoftheday.org/tips/why-dotnettipoftheday-can-lick-my-balls-a-memo1.aspx Thu, 03 Jul 2008 18:13:05 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=why-dotnettipoftheday-can-lick-my-balls-a-memo1 Why DotNetTipOfTheDay can lick my balls (a memo): <p>I think it is safe to say this website sucks ass.</p> <p>Practically two months without an update when people have been submitting things for you to post.</p> <p>I am pretty lazy when it comes to a lot of things, and up until today have kept your shitty RSS feed in my reader in hopes that you would actully update the site some day.</p> <p>But you suck and I hope your website bombs.&nbsp;</p> <p>Burn in hell.</p> <p>-thiswebsitesuck</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="dotnettipofthedayblowsass.com" style="font-weight:bold">thiswebsitesucks</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=WvSaDj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=WvSaDj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Mjh4xJ"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Mjh4xJ" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=TZ0A6j"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=TZ0A6j" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=d2PnAj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=d2PnAj" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=7M9PYJ"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=7M9PYJ" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=agzkAj"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=agzkAj" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/325822943" height="1" width="1"/> http://dotnettipoftheday.org/tips/why-dotnettipoftheday-can-lick-my-balls-a-memo.aspx Thu, 03 Jul 2008 18:12:44 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=why-dotnettipoftheday-can-lick-my-balls-a-memo Fill datset without open connection <p>There is no need&nbsp;</p> <p>Connection.Open</p> <p>Before calling Method</p> <p>Adapter.Fill(Dataset)</p> <p><br />like</p> <p>&nbsp;public override DataSet getSMCommentedSubmission(string prodID, string salesID)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; using (SqlConnection cn = new SqlConnection(this.ConnectionString))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlCommand cmd = new SqlCommand("sp_WB_Submission", cn);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; SqlDataAdapter adp = new SqlDataAdapter(cmd);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DataSet dset = new DataSet();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.CommandType = CommandType.StoredProcedure;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@SqType", SqlDbType.Int).Value = 48;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@PubPlanID", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@TypeID", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@Title", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@CommentID", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@ThemeText", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@StorySynopsys", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@Status", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@Comments", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@TimeStamp", SqlDbType.SmallDateTime).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@PublisherID", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@PermissionType", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@Checked", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@SMStatus", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@PMStatus", SqlDbType.VarChar).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@ProductionManagerID", SqlDbType.VarChar).Value = prodID;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@SalesManagerID", SqlDbType.VarChar).Value = salesID;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@StoryID", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cmd.Parameters.Add("@Review", SqlDbType.Int).Value = null;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; adp.Fill(dset);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return dset;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p> <p>&nbsp;</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Ajay</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=LJFLJi"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=LJFLJi" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=5F09zI"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=5F09zI" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=0a9MKi"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=0a9MKi" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=LdZcEi"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=LdZcEi" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=jbX1NI"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=jbX1NI" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=HCH9ti"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=HCH9ti" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/309368859" height="1" width="1"/> http://dotnettipoftheday.org/tips/fill-datset-without-open-connection1.aspx Wed, 11 Jun 2008 09:09:21 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=fill-datset-without-open-connection1 Never lock on a value type <p>When locking on a value type it gets boxed, meaning a new object instance is allocated and passed to the lock statement. Thus every time you lock on a value type, you're locking on a new object. Here is an example of&nbsp;<strong>bad</strong> code:</p> <div style="font-size: 10pt; background: white; color: black; font-family: Courier New;"> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">private</span> <span style="color: #0000ff;">bool</span> flag = <span style="color: #0000ff;">false</span>;</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">public</span> <span style="color: #0000ff;">void</span> Method1()</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #0000ff;">lock</span>(flag)</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; ...</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> </div> <p><!--EndFragment--></p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">kostya.ly</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=gIrIsi"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=gIrIsi" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ztnaMI"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ztnaMI" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=xNmoTi"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=xNmoTi" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=mHgiei"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=mHgiei" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=XlogKI"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=XlogKI" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Ay9j9i"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Ay9j9i" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/304735541" height="1" width="1"/> http://dotnettipoftheday.org/tips/never-lock-on-a-value-type.aspx Wed, 04 Jun 2008 23:01:26 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=never-lock-on-a-value-type need to use either “using” or explicitly close the connection if we use the datareader <p class="null"><span style="font-size: x-small; font-family: Arial;"><span style="font-size: 10pt; font-family: Arial;">We need to use either &ldquo;using&rdquo; or explicitly close the connection if we use the datareader.</span></span></p> <p class="null"><span style="font-size: x-small; font-family: Arial;"><span style="font-size: 10pt; font-family: Arial;">Otherwise, it will lead to Connection Pool error. See the underlined text below:</span></span></p> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 7.5pt;"><span style="font-size: xx-small; color: #000000; font-family: Verdana;"><span style="font-size: 8.5pt; color: #000000; font-family: Verdana;">&nbsp;</span></span></p> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 7.5pt;"><span style="font-size: xx-small; color: #000000; font-family: Verdana;"><span style="font-size: 8.5pt; color: #000000; font-family: Verdana;">However, there are other cases where it is unclear when to close the connection. An example is the <strong><span style="font-weight: bold;">ExecuteReader</span></strong> method. This method returns an object that implements the <strong><span style="font-weight: bold;">IDataReader</span></strong> interface. The <strong><span style="font-weight: bold;">Database</span></strong> base class has a default implementation that returns a <strong><span style="font-weight: bold;">DbDataReader</span></strong> object. <strong><span style="font-weight: bold;">DbDataReader</span></strong> objects are designed to read specific portions of the data as needed, which requires an open connection. In other words, it is unknown when the application no longer needs the <strong><span style="font-weight: bold;">DbDataReader</span></strong>. If the Data Access Application Block methods close the connection before returning the <strong><span style="font-weight: bold;">DbDataReader</span></strong>, the <strong><span style="font-weight: bold;">DbDataReader</span></strong> becomes useless to the client code. Instead, the <strong><span style="font-weight: bold;">DbDataReader</span></strong> methods indicate to the underlying ADO.NET call to automatically close the connection when the <strong><span style="font-weight: bold;">DbDataReader</span></strong> is finished. </span></span><span style="text-decoration: underline;"><span style="font-size: xx-small; color: #0000ff; font-family: Verdana;"><span style="font-size: 8.5pt; color: #0000ff; font-family: Verdana;">In this situation, it is considered a best practice for the application to ensure that the <strong><span style="font-weight: bold;">DbDataReader</span></strong> is closed in a timely fashion, either by explicitly closing the reader with the <strong><span style="font-weight: bold;">DbDataReader.close</span></strong> method or by forcing the disposal of the <strong><span style="font-weight: bold;">DbDataReader</span></strong>, which results in the <strong><span style="font-weight: bold;">Close</span></strong> method being called.</span></span></span></p> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 7.5pt;"><span style="text-decoration: underline;"><span style="font-size: xx-small; color: #0000ff; font-family: Verdana;"><span style="font-size: 8.5pt; color: #0000ff; font-family: Verdana;">The following code demonstrates a call to the <strong><span style="font-weight: bold;">ExecuteReader</span></strong> method. The <strong><span style="font-weight: bold;">using</span></strong> statement (<strong><span style="font-weight: bold;">Using</span></strong> in Visual Basic) ensures that the <strong><span style="font-weight: bold;">DbDataReader</span></strong> object is disposed, which closes the <strong><span style="font-weight: bold;">DbDataReader</span></strong> object.</span></span></span></p> <table class="MsoNormalTable" style="width: 98.9%;" border="0" cellspacing="0" cellpadding="0" width="98%"> <tbody> <tr> <td style="border-right: medium none; padding-right: 3.75pt; border-top: medium none; padding-left: 3.75pt; background: #efeff7; padding-bottom: 0in; border-left: medium none; padding-top: 0in; border-bottom: #c8cdde 1pt solid;" valign="top" bgcolor="#efeff7"> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 3.75pt;"><strong><span style="font-size: medium; color: #000066; font-family: Verdana;"> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 3.75pt;"><strong><span style="font-size: medium; color: #000066; font-family: Verdana;"><span style="font-weight: bold; font-size: 13.5pt; color: #000066; font-family: Verdana;"><span>[C#]&nbsp;</span></span></span></strong></p> </span></strong></p> </td> <td style="border-right: medium none; padding-right: 3.75pt; border-top: medium none; padding-left: 3.75pt; background: #efeff7; padding-bottom: 0in; border-left: medium none; padding-top: 0in; border-bottom: #c8cdde 1pt solid;" valign="top" bgcolor="#efeff7"> <p class="null" style="margin-bottom: 3.75pt; margin-left: 0in; margin-right: 0in; mso-margin-top-alt: 3.75pt;">&nbsp;</p> </td> </tr> <tr> <td style="border-right: medium none; padding-right: 3.75pt; border-top: white 1pt solid; padding-left: 3.75pt; background: #f7f7ff; padding-bottom: 0in; border-left: medium none; padding-top: 3.75pt; border-bottom: #d5d5d3 1pt solid;" colspan="2" valign="top" bgcolor="#f7f7ff"> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">Database db = DatabaseFactory.CreateDatabase();</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">&nbsp;</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">DbCommand dbCommand = db.GetSqlStringCommand("Select Name, Address From Customers");</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">using (IDataReader dataReader = db.ExecuteReader(dbCommand))</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">{</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">// Process results</span></span></p> <p class="null" style="margin-bottom: 0pt; margin-left: 0.75pt; margin-right: 0.75pt; mso-margin-top-alt: 0in;"><span style="font-size: medium; color: #000066; font-family: Courier New;"><span style="font-size: 14pt; color: #000066; font-family: 'Courier New';">} </span></span></p> </td> </tr> </tbody> </table> <p class="null"><span style="font-size: x-small; font-family: Arial;"></span></p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">saisuchir</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=mVCmNh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=mVCmNh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=8DyLIH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=8DyLIH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=fRL1qh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=fRL1qh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=sPY2Ch"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=sPY2Ch" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=sDbG6H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=sDbG6H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=L2xXbh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=L2xXbh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/290914086" height="1" width="1"/> http://dotnettipoftheday.org/tips/need-to-use-either-using-or-explicitly-close-the-connection-if-we-use-.aspx Thu, 15 May 2008 16:49:14 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=need-to-use-either-using-or-explicitly-close-the-connection-if-we-use- BrowsableAttribute <p>when u are creating a control, and u decides that a property or a event should not be displayed in property window.</p> <p>System.ComponentModel.BrowsableAttribute is there for you, to do the above.</p> <p>Eg:</p> <p>private string text;</p> <p>[Browsable(false)]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //&nbsp; True is default<br />&nbsp;public string Text<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; get<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return text;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; text = value;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp; }</p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">dhanaid</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=u8qffh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=u8qffh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=o0HSnH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=o0HSnH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=M0I1Ch"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=M0I1Ch" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=r1Jsyh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=r1Jsyh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=nACm6H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=nACm6H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=gUqeVh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=gUqeVh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/289388260" height="1" width="1"/> http://dotnettipoftheday.org/tips/browsableattribute.aspx Tue, 13 May 2008 15:43:13 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=browsableattribute Get rid of unused usings <p>In a Visual Studio 2008 source window,&nbsp;right-click and&nbsp;select&nbsp;<strong>Organize Usings</strong> | <strong>Remove Unused Usings</strong>. Visual Studio 2005 users may use <a href="http://www.jetbrains.com/resharper/features/code_formatting.html#Namespace_Import_Directives_Optimization_full">ReSharper</a> for this.</p> <p>&nbsp;</p> <p>P.S. interesting, does&nbsp;this optimization&nbsp;gives you&nbsp;any benefits other than cleaner code?</p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">kostya.ly</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=G5mL7h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=G5mL7h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=jEQ8eH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=jEQ8eH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wH61Ch"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wH61Ch" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=SultUh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=SultUh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=hgWlrH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=hgWlrH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ADJJJh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ADJJJh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/288781512" height="1" width="1"/> http://dotnettipoftheday.org/tips/get-rid-of-unused-usings.aspx Mon, 12 May 2008 20:05:08 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=get-rid-of-unused-usings Capitalization of ID and OK abbreviations used in identifiers <p>I was wondering how to&nbsp;capitalize&nbsp;properties which have either ID or OK abbreviation in its name. For example, is it&nbsp;TipID or TipId?&nbsp;I have found the answer in <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx">Design Guidelines for Developing Class Libraries</a>:</p> <p><em>In Pascal-cased identifiers (all identifiers except parameter names)&nbsp;they should appear as <span class="code">Id</span>, and <span class="code">Ok</span>. If used as the first word in a camel-cased identifier, they should appear as <span class="code">id</span> and <span class="code">ok</span>, respectively.</em></p> <p>&nbsp;</p> <p>P.S. And of course .NET Framework doesn't fulfil this rule :) For example, <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx">Control.ClientID</a> property.</p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">kostya.ly</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=9ZCWvh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=9ZCWvh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=LfQ65H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=LfQ65H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=VS9bmh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=VS9bmh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=seR12h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=seR12h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=IQ9c3H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=IQ9c3H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=CcAFOh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=CcAFOh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975520" height="1" width="1"/> http://dotnettipoftheday.org/tips/capitalization-of-id-and-ok-abbreviations-used-in-identifiers.aspx Wed, 07 May 2008 01:59:56 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=capitalization-of-id-and-ok-abbreviations-used-in-identifiers How to loop through all rows of the DataTable? <div style="font-family:Courier New; font-size:10pt; color:#000000"> <p style="margin: 0px;"><span style="color: #0000FF">foreach</span> (DataRow row <span style="color: #0000FF">in</span> dTable.Rows)</p> <p style="margin: 0px;">{</p> <p style="margin: 0px;">yourvariable = row[<span style="color: #a31515">"ColumnName"</span>].ToString();</p> <p style="margin: 0px;">}</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;"><span style="color: #008200">//OR </span></p> <p style="margin: 0px;"><span style="color: #0000FF">for</span> (<span style="color: #0000FF">int</span> j = 0; j&lt; dTable.Rows.Count; j++)</p> <p style="margin: 0px;">{</p> <p style="margin: 0px;">yourvariable = dTable.Rows[j][<span style="color: #a31515">"ColumnName"</span>].ToString()l</p> <p style="margin: 0px;">}</p> <p style="margin: 0px;">&nbsp;</p> </div><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.dotnetfunda.com/profile/Raja.aspx" style="font-weight:bold">Raja</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=xn22nh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=xn22nh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=pJnfVH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=pJnfVH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wvwDAh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wvwDAh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=zn9bvh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=zn9bvh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=nyICcH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=nyICcH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=vm6fOh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=vm6fOh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975521" height="1" width="1"/> http://dotnettipoftheday.org/tips/b2da9bd7-6629-4397-bd12-fd49072e88b4.aspx Wed, 30 Apr 2008 19:35:54 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=b2da9bd7-6629-4397-bd12-fd49072e88b4 To avoid line by line debug using F11 <p>Use DebuggerStepThroughAttribute</p> <p>&nbsp;[System.Diagnostics.DebuggerStepThrough()]</p> <p>public void sample()</p> <p>{</p> <p>// ....</p> <p>}</p> <p>&nbsp;</p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">dhanaid</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=JPVNah"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=JPVNah" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=a64tJH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=a64tJH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=bjwEyh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=bjwEyh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=LiN4Lh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=LiN4Lh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=7iXeVH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=7iXeVH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=05waWh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=05waWh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975522" height="1" width="1"/> http://dotnettipoftheday.org/tips/b086b5ee-4547-4ed6-abce-5f4ad8ecf47a.aspx Tue, 29 Apr 2008 13:58:47 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=b086b5ee-4547-4ed6-abce-5f4ad8ecf47a Bind a TreeView to a DataSet or an ObjectDataSource with one line of code <p>This post has a class that allows you to&nbsp;bind your TreeView to a dataSet very easily.&nbsp;</p> <p><a href="http://www.varjabedian.net/archive/2008/04/22/binding-asp.net-treeview-to-a-dataset-or-an-objectdatasource.aspx">http://www.varjabedian.net/archive/2008/04/22/binding-asp.net-treeview-to-a-dataset-or-an-objectdatasource.aspx</a></p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://varjabedian.net" style="font-weight:bold">Ralph Varjabedian</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=3LRuRh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=3LRuRh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=p2c9BH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=p2c9BH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Tt0f1h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Tt0f1h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=LtgtNh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=LtgtNh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=F8LtEH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=F8LtEH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=xUfKdh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=xUfKdh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975523" height="1" width="1"/> http://dotnettipoftheday.org/tips/b5a838eb-09f9-4e5a-a911-d5b7cfbce413.aspx Wed, 23 Apr 2008 15:19:16 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=b5a838eb-09f9-4e5a-a911-d5b7cfbce413 Usuful VS Shortcuts <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">F7</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jump to Code Behind</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"><span style="font-family: Times New Roman;"> </span></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+F6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Navigate between various opened panes</span></em><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+Shift+V</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;Cycle through the clipboard ring</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">CTRL+K+K&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create or delete Bookmark</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+K+D</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Auto-format whole page</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+K+F</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Auto-format selection</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+U</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert to lower case</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+Shift+U</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;Convert to upper case</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+M+M&nbsp;</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fold/Unfold the current code block</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Ctrl+M+L</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unfold all</span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></span></p> <p class="null" style="background: #fff8d9; margin: 0in 0in 0pt;"><span style="font-size: small;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">Block Selection</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;" lang="EN">&nbsp; Press and hold Alt and then select the area you want with your mouse.</span></span><span style="color: #080808; mso-ansi-language: EN;" lang="EN"></span></p><p style="font-style:italic; margin-top:20px;">submitted by <img src="http://dotnettipoftheday.org/WebResource.axd?d=3ZWCaBAJirlAje9qBpEF_uy25G40F6llhSthHLl0P6_pxs4obrJPLicputzxRXm-JYfzbRa1AEss2A7sRS4JjGxEFgnmfq_sOwTJoJueUx8ZH-1F8IxmZZwz0nmLgJIw0&t=633458066039692085" style="vertical-align:middle" /><span style="font-weight:bold">eswarp</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MWMW4h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MWMW4h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=NY7q3H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=NY7q3H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=BZDHXh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=BZDHXh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=FbLk8h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=FbLk8h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=cR6QLH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=cR6QLH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=5NXB1h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=5NXB1h" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975524" height="1" width="1"/> http://dotnettipoftheday.org/tips/a0fe6f3b-96cd-4a7e-ba20-1c2df728c7e9.aspx Thu, 17 Apr 2008 20:23:07 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=a0fe6f3b-96cd-4a7e-ba20-1c2df728c7e9 Useful VS Shortcuts <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; mso-ansi-language: EN;"><span style="font-size: small;"><span style="font-family: Times New Roman;"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">F7</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Jump to Code Behind</span><font style="color: #080808; mso-ansi-language: EN;" color="#080808"><font size="3"><font face="Times New Roman"> <p class="null" style="MARGIN: 0in 0in 0pt"> <p> <p class="null" style="MARGIN: 0in 0in 0pt"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">Ctrl+F6&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Navigate between various opened panes</span></em></p> <p class="null" style="MARGIN: 0in 0in 0pt"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">Ctrl+Shift+V</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">&nbsp;&nbsp;&nbsp;&nbsp;Cycle through the clipboard ring</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">CTRL+K+K&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Create or delete Bookmark</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">Ctrl+K+D</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Auto-format whole page</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;"><em>Ctrl+K+F</em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Auto-format selection</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;"><em>Ctrl+U</em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Convert to lower case</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;"><em>Ctrl+Shift+U</em>&nbsp;&nbsp;&nbsp;&nbsp;Convert to upper case</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">Ctrl+M+M&nbsp;</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Fold/Unfold the current code block</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;"><em>Ctrl+M+L</em>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Unfold all</span></p> <p class="null" style="MARGIN: 0in 0in 0pt"><em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">Block Selection</span></em><span style="color: #080808; font-family: Arial; mso-ansi-language: EN;">&nbsp; Press and hold Alt and then select the area you want with your mouse.</span></p> <p>&nbsp;</p> </p> </p> </font></font></font></span><font style="color: #080808; mso-ansi-language: EN;" color="#080808"><font size="3"> <p class="null" style="MARGIN: 0in 0in 0pt">&nbsp;</p> </font></font></span><font style="color: #080808; mso-ansi-language: EN;" color="#080808"> <p class="null" style="MARGIN: 0in 0in 0pt">&nbsp;</p> </font></span></p> <p class="null" style="MARGIN: 0in 0in 0pt">&nbsp;</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Eswar</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=COT0mh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=COT0mh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=AvZPMH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=AvZPMH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=i1rPdh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=i1rPdh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=2vaQBh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=2vaQBh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=N3oaiH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=N3oaiH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=0HpfLh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=0HpfLh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975526" height="1" width="1"/> http://dotnettipoftheday.org/tips/89b6e2ba-60ba-4b0b-9323-60270a59e7e2.aspx Thu, 17 Apr 2008 20:20:45 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=89b6e2ba-60ba-4b0b-9323-60270a59e7e2 Summary Tag in visual studio 2008 IDE <p>want to XML comment ur code ??</p> <p>just type /// (three slashes) on top of any class or method and the vs 2008 ide will automaticaly generate summary tag which will also give you out of the box functionality of intellisense when you use the particualar method with summary tag here is an example</p> <p><a title="screenshot from msdn" href="http://msdn.microsoft.com/vstudio/tour/vs2005_guided_tour/VS2005pro/Library/XMLComments.2.jpg" target="_blank">http://msdn.microsoft.com/vstudio/tour/vs2005_guided_tour/VS2005pro/Library/XMLComments.2.jpg</a></p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">l33tc0der</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=DtOFRh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=DtOFRh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=IgJbIH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=IgJbIH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=g1r1fh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=g1r1fh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=0Pn6uh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=0Pn6uh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=g3vQSH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=g3vQSH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=FKMFUh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=FKMFUh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975527" height="1" width="1"/> http://dotnettipoftheday.org/tips/3C2582C4-551B-487A-90CE-643CB6C0306C.aspx Sun, 06 Apr 2008 01:00:59 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=3C2582C4-551B-487A-90CE-643CB6C0306C Can you store multiple data types in System.Array? <p>If you search the answer for this questions, you will find most websites just copy the answer "No", but actualy the correct answer should be Yes, because the code below proves it: C# System.Object[] test_array = new System.Object[6]; test_array[0]="123go!"; test_array[1]=2007.7; test_array[2]=true;</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://kailashdhondiyal.brainuse.com" style="font-weight:bold">Kailash Dhondiyal</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=klKwXh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=klKwXh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=bTgkUH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=bTgkUH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=00qNJh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=00qNJh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=b4LyKh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=b4LyKh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=TeVctH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=TeVctH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=h39dJh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=h39dJh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975528" height="1" width="1"/> http://dotnettipoftheday.org/tips/654E4F30-17FF-4357-B544-D3502FF3A60C.aspx Sat, 05 Apr 2008 21:03:45 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=654E4F30-17FF-4357-B544-D3502FF3A60C Parse vs TryParse in conversion from string <p>Consider using TryParse and TryParseExact when converting from string to int, long, DateTime, etc. TryParse functions return true if conversion was successful and resulted value returned in out parameter. They do not throw an exception, which is a lot faster than Parse functions.</p> <div style="font-family:Courier New; font-size:10pt; color:#000000"> <p style="margin: 0px;"><span style="color: #0000FF">string</span> ageStr = <span style="color: #a31515">"35"</span>;</p> <p style="margin: 0px;"><span style="color: #0000FF">string</span> invalidAgeStr = <span style="color: #a31515">"TestAge 35"</span>;</p> <p style="margin: 0px;"><span style="color: #0000FF">int</span> age = 0;</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;"><span style="color: #0000FF">if</span> (<span style="color: #0000FF">int</span>.TryParse(ageStr, <span style="color: #0000FF">out</span> age))</p> <p style="margin: 0px;">{</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; MessageBox.Show(<span style="color: #a31515">"Age: "</span> + age);</p> <p style="margin: 0px;">}</p> <p style="margin: 0px;"><span style="color: #0000FF">if</span> (!<span style="color: #0000FF">int</span>.TryParse(invalidAgeStr, <span style="color: #0000FF">out</span> age))</p> <p style="margin: 0px;">{</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; MessageBox.Show(<span style="color: #a31515">"Invalid Age: "</span> + invalidAgeStr);</p> <p style="margin: 0px;">}</p> </div> &nbsp;<p style="font-style:italic; margin-top:20px;">submitted by <a href="http://software-development-toolbox.blogspot.com/" style="font-weight:bold">Vlad</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=DgBCah"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=DgBCah" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=h3cfyH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=h3cfyH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=I2QOUh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=I2QOUh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=eg5Sxh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=eg5Sxh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=912PwH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=912PwH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MT3AFh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MT3AFh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975529" height="1" width="1"/> http://dotnettipoftheday.org/tips/36F0558F-E7C1-4D13-A107-26268B24F700.aspx Thu, 03 Apr 2008 06:51:25 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=36F0558F-E7C1-4D13-A107-26268B24F700 Opening file in Windows Explorer - Faster <p>Using this tip to add the Windows Explorer to the tools list <a href="http://dotnettipoftheday.org/tips/explorer-in-tools-menu.aspx">http://dotnettipoftheday.org/tips/explorer-in-tools-menu.aspx</a>. You can assign a keyboard shortcut to it.</p> <p>Open the tools menu to identify which external command the Windows Explorer is set as, then select Tools -&gt; Customize and choose Keyboard. Enter "External Command" in the search box. Select the command number based on what was displayed in the tools menu and assign a keyboard shortcut.</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.madcookie.net" style="font-weight:bold">MADCookie</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MBls8h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MBls8h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ds4NoH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ds4NoH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=m4jdOh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=m4jdOh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=7AQSmh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=7AQSmh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=J2nSrH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=J2nSrH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=rUo2Gh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=rUo2Gh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975530" height="1" width="1"/> http://dotnettipoftheday.org/tips/0D8AD841-551B-47D7-ADC9-4FC31E48487D.aspx Mon, 24 Mar 2008 18:57:32 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=0D8AD841-551B-47D7-ADC9-4FC31E48487D Use &quot;it's&quot; and &quot;its&quot; Correctly "it's" is the contraction of "it is" "its" is possessive If you can re-word your "its" as "it is" then you're not using it correctly. <p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Rich Wilson</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=i6YQph"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=i6YQph" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=S83fJH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=S83fJH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wwaVNh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wwaVNh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=kW41ph"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=kW41ph" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MTY30H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MTY30H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=0l4rEh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=0l4rEh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975531" height="1" width="1"/> http://dotnettipoftheday.org/tips/2707B35E-FE43-48E7-8F0D-EDF556425E3F.aspx Mon, 24 Mar 2008 18:52:11 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=2707B35E-FE43-48E7-8F0D-EDF556425E3F Get UserId from User Name in ASP.NET <div style="font-family:Courier New; font-size:10pt; color:#000000"> <p style="margin: 0px;">MembershipUser myUser = Membership.GetUser();</p> <p style="margin: 0px;"><span style="color: #0000ff;">string</span> userID = myUser.ProviderUserKey.ToString()</p> </div> <p>or</p> <div style="font-family:Courier New; font-size:10pt; color:#000000"> <p style="margin: 0px;">MembershipUser myUser = Membership.GetUser(My.User.Name);</p> <p style="margin: 0px;"><span style="color: #0000ff;">string</span> userID = myUser.ProviderUserKey.ToString()</p> </div> <p>&nbsp;&nbsp;</p> <p><span style="text-decoration: underline;">Links</span></p> <ul> <li><a href=" http://msdn2.microsoft.com/en-us/library/system.web.security.membership.getuser.aspx">Membership.GetUser Method</a><br />Gets the information for a membership user from the data source.</li> </ul><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://geeks.ms/blogs/fernandezja" style="font-weight:bold">Jose A. Fernandez</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=rVO5Uh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=rVO5Uh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=orlo3H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=orlo3H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=6M6PRh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=6M6PRh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=mHEznh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=mHEznh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=AwTdEH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=AwTdEH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=HAFT6h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=HAFT6h" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975532" height="1" width="1"/> http://dotnettipoftheday.org/tips/EE173589-310F-4ACC-A090-BA6A2F747F9B.aspx Mon, 17 Mar 2008 09:07:13 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=EE173589-310F-4ACC-A090-BA6A2F747F9B Reading Eventlog of a Remote Machine <p>Reading Eventlog of a Remote Machine</p> <ol> <li>Include System.Diagnostics</li> <li>Getting the eventlogs of a remote machine say MachineName<br /> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;">EventLog[] eLogs = EventLog.GetEventLogs(MachineName); <span style="color: #008200;">//Can also use IPAddress of the machine as EventLog.GetEventLogs(IPAddress)</span></p> </div> The name of the ith eventlog can be obtained from the eLogs[i].LogDisplayName property of the eventlog object.</li> <li>Suppose we want to get the object for the eventlog named MyEventLog in machine MachineName. We can get that as:<br /> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;">EventLog elog = <span style="color: #0000ff;">new</span> EventLog(MyEventLog , MachineName);</p> </div> </li> <li>To access the different entries in the eventlog we can use the array eLog.Entries<br />For ith entry, the different properties we can get are:<br /> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;">elog.Entries[i].EntryType</p> <p style="margin: 0px;">elog.Entries[i].TimeGenerated</p> <p style="margin: 0px;">elog.Entries[i].Source</p> <p style="margin: 0px;">elog.Entries[i].Category</p> <p style="margin: 0px;">elog.Entries[i].InstanceId</p> <p style="margin: 0px;">elog.Entries[i].UserName</p> <p style="margin: 0px;">elog.Entries[i].Message</p> <p style="margin: 0px;">elog.Entries[i].MachineName</p> </div> </li> </ol><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Saurav Kumar Jaiswal</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=HTOkFh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=HTOkFh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=K8DLPH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=K8DLPH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=lppDQh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=lppDQh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=rAfmeh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=rAfmeh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=dtoXWH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=dtoXWH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=NNA06h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=NNA06h" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975534" height="1" width="1"/> http://dotnettipoftheday.org/tips/EC8E14E4-4C95-4CA0-A8E6-C06882F2237D.aspx Tue, 04 Mar 2008 14:41:49 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=EC8E14E4-4C95-4CA0-A8E6-C06882F2237D Add Windows Explorer to your Visual Studio tools menu <p>I often need to open Windows Explorer and browse to the current file, folder, or project that I am working on in Visual Studio.&nbsp;This tip allows you to achieve this by clicking "Windows Explorer" in the Tools menu, and is one of the most simple-yet-useful tips I know of.</p> <p>To set it up, click "Tools", then "External Tools...", then click "Add".&nbsp; Now enter the following data:<br />Title: Windows Explorer<br />Command: explorer.exe<br />Arguments: /select,"$(ItemPath)"</p> <p>Leave "Initial directoy" blank, and click "OK".&nbsp; Now when you click "Tools", "Windows Explorer", Windows Explorer will open with the current file you are editing selected.</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.picwa.com" style="font-weight:bold">Daniel Flower</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=NQ8zIh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=NQ8zIh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ohBGdH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ohBGdH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=75DAkh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=75DAkh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=nVCpfh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=nVCpfh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=53ArDH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=53ArDH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=vnDHoh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=vnDHoh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975535" height="1" width="1"/> http://dotnettipoftheday.org/tips/CC6C910F-1A7B-4682-B819-6905F9AD5F17.aspx Sun, 24 Feb 2008 05:57:40 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=CC6C910F-1A7B-4682-B819-6905F9AD5F17 Toggle intelisense transperancy on the fly <p>When typing in VS2008 and intellisense blocks the view of the lines of code underneath. You can hold down the <code style="color:teal">Ctrl</code> key to toggle the opacity of the intelisense box so that you can see the code under it.</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.nansen.se" style="font-weight:bold">Kalle Hoppe</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=SQFDTh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=SQFDTh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=HBUiGH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=HBUiGH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=QFwbnh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=QFwbnh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=YeMenh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=YeMenh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=1donjH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=1donjH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=2ZVlLh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=2ZVlLh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975537" height="1" width="1"/> http://dotnettipoftheday.org/tips/1B1C8319-4B17-45D9-AE7B-365563CABD40.aspx Mon, 18 Feb 2008 12:32:55 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=1B1C8319-4B17-45D9-AE7B-365563CABD40 WPF Textbox memory leak <p>While running around in the WPF forums, I found this very interesting post (<a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2823829&amp;SiteID=1">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2823829&amp;SiteID=1</a>)&hellip; It seems that the WPF TextBox can be dangerous :) - if you do not use it carefully :)</p> <p>Basically the TextBox by default stores all text changes in an Undo Stack&hellip; This implies that every time that you change the Text of the TextBox more memory is consumed by the TextBox.</p> <p>In order to fix this you have to set the UndoLimit property to 0. This would disable the Undo feature for the TextBox and thus NO MORE MEMORY CONSUMPTION &hellip;</p> <p>Have a nice day</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://marlongrech.wordpress.com" style="font-weight:bold">Marlon Grech</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=KGZK9h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=KGZK9h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=lxH2VH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=lxH2VH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=aMV72h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=aMV72h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=gfzlnh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=gfzlnh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=DQJdVH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=DQJdVH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=6fucVh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=6fucVh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975538" height="1" width="1"/> http://dotnettipoftheday.org/tips/006BBAA9-AAAC-4CB3-9F2B-09A5D0475E59.aspx Sat, 16 Feb 2008 12:27:39 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=006BBAA9-AAAC-4CB3-9F2B-09A5D0475E59 Format your code <p>You can format your code by selecting the code you want to format and pressing <code style="color:teal">ctl + K +F</code>. This shortcut can also be applied to html.</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="bshouman.blogspot.com" style="font-weight:bold">Bilal Shouman</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=gq0fVh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=gq0fVh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=btsvNH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=btsvNH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=hxB2Ih"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=hxB2Ih" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=d1wb5h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=d1wb5h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=vf64bH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=vf64bH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=I1qcLh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=I1qcLh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975539" height="1" width="1"/> http://dotnettipoftheday.org/tips/E74C89DB-48C6-4477-A0DE-61FBB0AF7768.aspx Tue, 12 Feb 2008 00:51:30 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=E74C89DB-48C6-4477-A0DE-61FBB0AF7768 Adding required field validator to DropDownList <p>You can set a required field validator to a drop down list as follows</p> <p>&lt;asp:DropDownList ID="ddlItems" runat="server"&gt;<br />&nbsp;&nbsp;&nbsp; &lt;asp:ListItem Text="&lt;--Select Item--&gt;" Value=""&gt;&lt;/asp:ListItem&gt;<br />&nbsp;&nbsp;&nbsp; &lt;asp:ListItem Text="Item 1" Value="1"&gt;&lt;/asp:ListItem&gt;<br />&nbsp;&nbsp;&nbsp; &lt;asp:ListItem Text="Item 2" Value="2"&gt;&lt;/asp:ListItem&gt;<br />&nbsp;&nbsp;&nbsp; &lt;asp:ListItem Text="Item 3" Value="3"&gt;&lt;/asp:ListItem&gt;<br />&lt;/asp:DropDownList&gt;</p> <p>&lt;asp:RequiredFieldValidator ID="RequiredFieldValidator1" ControlToValidate="ddlItems" runat="server" ErrorMessage="Please select an item" Text="Pelase select an Item"&gt;&lt;/asp:RequiredFieldValidator&gt;</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="bshouman.blogspot.com" style="font-weight:bold">Bilal Shouman</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=uDMAFh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=uDMAFh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=CMcv9H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=CMcv9H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wk5T1h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wk5T1h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=ExbrUh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=ExbrUh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=VhKCUH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=VhKCUH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Xfle8h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Xfle8h" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975541" height="1" width="1"/> http://dotnettipoftheday.org/tips/D2D20128-821A-41D8-9DD3-4F26CFFB7AB8.aspx Tue, 12 Feb 2008 00:32:17 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=D2D20128-821A-41D8-9DD3-4F26CFFB7AB8 Show/Hide ASP.NET Non-visual controls in the designer <p>Sometimes it is useful to show/hide ASP.NET Non-visual controls in the designer. For this:</p> <ol> <li>Swith to Design view</li> <li>From the View menu, click Visual Aids and select/unselect ASP.NET Non-visual Control option or just press <code style="color:teal">CTRL+SHIFT+N</code>.</li> </ol> <p>Enjoy! :)</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.godevs.com" style="font-weight:bold">Sergey P.</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=TL8Ilh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=TL8Ilh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=WWHRLH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=WWHRLH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Gtt4Ah"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Gtt4Ah" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=1XKMRh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=1XKMRh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=8YBjgH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=8YBjgH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Ls6TBh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Ls6TBh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975542" height="1" width="1"/> http://dotnettipoftheday.org/tips/B0681AC4-6F65-44C3-B793-ABFFDBA0967D.aspx Mon, 11 Feb 2008 13:19:51 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=B0681AC4-6F65-44C3-B793-ABFFDBA0967D Chaining the C# ?? Operator <p>In C# you can shortcut this special null comparison case with the new ??:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">string</span> result = value1 ?? value2;</p> </div> <p>which is a little easier to write. This is probably not news to you, but what's really useful is that you can chain these operators together so you can do a whole bunch of null comparisons in a single stroke. For example, I frequently look for a few different querystring variables in a page:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">string</span> partner = Request.QueryString[<span style="color: #a31515">"GoogleId"</span>] ??</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; Request.QueryString[<span style="color: #a31515">"PartnerId"</span>] ??</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; Request.QueryString[<span style="color: #a31515">"UserKey"</span>] ??</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">string</span>.Empty;</p> </div> <p>which still yields a valid result for the first non-null querystring or if nothing is found returning "".</p> <p>More found here: <a href="http://www.west-wind.com/weblog/posts/236298.aspx">http://www.west-wind.com/weblog/posts/236298.aspx</a>&nbsp;</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.west-wind.com/weblog/posts/236298.aspx" style="font-weight:bold">Jacob Cook</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=PzCilh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=PzCilh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=5WHAkH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=5WHAkH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Qq9GTh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Qq9GTh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=exAMqh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=exAMqh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=O2u2QH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=O2u2QH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=29f9bh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=29f9bh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975543" height="1" width="1"/> http://dotnettipoftheday.org/tips/FFC1B3B2-2F81-4CA3-A9E2-9E91C6465448.aspx Tue, 29 Jan 2008 18:33:18 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=FFC1B3B2-2F81-4CA3-A9E2-9E91C6465448 How to enable Text Editor Guide Lines in Visual Studio <p>A not well known feature of Visual Studio (2002/3/5/8) is the ability to add a Guide Line to the text editor, which would show a visible line indicating a specific column. This feature of Visual Studio lets you display a vertical line at the column of your choosing to help visually see when a line is getting too long. This helps you to define a maximum acceptable column, where code should have a line break to look clear and sharp on all monitor resolutions.</p> <p>Please beware that registry manipulation is needed, so DO IT AT YOUR OWN RISK!</p> <p>Open a command prompt and run the following command:</p> <p>REG ADD "HKCU\Software\Microsoft\VisualStudio\[Version]\Text Editor" /v Guides /d "RGB([R],[G],[B]) [COL1], [COL2]"</p> <p>You should replace:</p> <ul> <li>[Version]- the Visual Studio Version (Please note: 2005 = 8.0 ; 2008 = 9.0)</li> <li>[R]&nbsp; = RGB Red value (0-255) of the line</li> <li>[G]&nbsp; = RGB Green value (0-255) of the line</li> <li>[B]&nbsp; = RGB Blue value (0-255) of the line</li> <li>[COL1] [COL2] = The column number where to show the line. You can have at most 13 lines.</li> </ul> <p>As an example, you can run the following command:</p> <p>REG ADD "HKCU\Software\Microsoft\VisualStudio\8.0\Text Editor" /v Guides /d "RGB(128,0,0) 80, 120</p> <p>Which would add two columns (column 80 and column 120).</p> <p>Voil&aacute;! Now you know when lines are to large...</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://www.arquitecturadesoftware.org/blogs/hugobatista" style="font-weight:bold">Hugo Batista</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=7aKrTh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=7aKrTh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=fLhlpH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=fLhlpH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Azp15h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Azp15h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=T8ycah"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=T8ycah" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=AYeQsH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=AYeQsH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MdRzyh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MdRzyh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975544" height="1" width="1"/> http://dotnettipoftheday.org/tips/6B29ED91-DE6C-425F-9E28-95EED8153F0C.aspx Fri, 25 Jan 2008 19:29:05 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=6B29ED91-DE6C-425F-9E28-95EED8153F0C Disable Theming and StyleSheet theme for one specific page in Asp.Net <p>The theming features of asp.net works by just putting one line inside the Web.Config file, this to enable a theme and change the look of the complete website. But what to do when you want to disable everything for one specific page?</p> <p>There are 2 page directives, Theme and StyleSheetTheme that help setting the themes.</p> <p>&lt;%@ Page Language=&rdquo;C#&rdquo; Theme=&rdquo;OrangeTheme&rdquo; StyleSheetTheme=&rdquo;GreenTheme&rdquo; %&gt;</p> <p>&nbsp;</p> <p>But to disable them the documentation will only provide following answer.</p> <p>&lt;%@ Page Language=&rdquo;C#&rdquo; EnableTheming=&rdquo;false&rdquo; %&gt;</p> <p>&nbsp;</p> <p>But the EnableTheming will only effect the choosen theme and will not effect the StyleSheet theme!!!<br />So to disable both these features just use following code:</p> <p>&lt;%@ Page Language=&rdquo;C#&rdquo; Theme="" StyleSheetTheme="" %&gt;</p> <p>Took me a while to figure this one out :)</p><p style="font-style:italic; margin-top:20px;">submitted by <a href="http://depblog.weblogs.us" style="font-weight:bold">Glenn Versweyveld</a></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=aG0OAh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=aG0OAh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Q0kZKH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Q0kZKH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=bWgEuh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=bWgEuh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=fnHVKh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=fnHVKh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=lnRQ4H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=lnRQ4H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=S8JUzh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=S8JUzh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975545" height="1" width="1"/> http://dotnettipoftheday.org/tips/3704C055-8F3A-4BD6-892B-8883296C62FA.aspx Fri, 25 Jan 2008 12:05:38 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=3704C055-8F3A-4BD6-892B-8883296C62FA Clear &quot;Recent Projects&quot; list from Start page in Visual Studio .NET <p>Here is a nice tips to clear the Recent project list or File list from "Start page" of Visual Studio.Net</p> <p>Go to Start -&gt; Run -&gt; RegEdit</p> <p>and navigate to HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\\ProjectMRUList delete unnecessary list.</p> <p>Similarly for FileMRuList.</p> <p>Make sure not disturb other key from the registry.</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Kaushal</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=r2jrRh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=r2jrRh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=9Tyx9H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=9Tyx9H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=9lskuh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=9lskuh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=WKLm1h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=WKLm1h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=dXMQ6H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=dXMQ6H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=AQ2kqh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=AQ2kqh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975546" height="1" width="1"/> http://dotnettipoftheday.org/tips/E3F59036-93B2-40A0-A22E-805F6C227DD9.aspx Thu, 24 Jan 2008 14:35:08 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=E3F59036-93B2-40A0-A22E-805F6C227DD9 Automatic Properties <p>In the latest release of Orcas, one of the new features provided is "Automatic Properties" which allows developers to use a shorthand like the following:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">public</span> <span style="color: #0000FF">class</span> Person {</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">string</span> FirstName {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get; set;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">string</span> LastName {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get; set;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">int</span> Age {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get; set;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">}</p> </div> <p>and the compiler knows to interpret this as</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">public</span> <span style="color: #0000FF">class</span> Person {</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">private</span> <span style="color: #0000FF">string</span> _firstName;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">private</span> <span style="color: #0000FF">string</span> _lastName;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">private</span> <span style="color: #0000FF">int</span> _age;</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">string</span> FirstName {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #0000FF">return</span> _firstName;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _firstName = value;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">string</span> LastName {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #0000FF">return</span> _lastName;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _lastName = value;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; <span style="color: #0000FF">public</span> <span style="color: #0000FF">int</span> Age {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; get {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <span style="color: #0000FF">return</span> _age;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; set {</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; _age = value;</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; }</p> <p style="margin: 0px;">}</p> </div><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Joe</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wf7XYh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wf7XYh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=52z40H"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=52z40H" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=NSPWeh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=NSPWeh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=GPXLzh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=GPXLzh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=nSzqjH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=nSzqjH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=yarlph"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=yarlph" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975547" height="1" width="1"/> http://dotnettipoftheday.org/tips/26CE92F0-A02B-4FBE-ADFA-F4E9346833A9.aspx Thu, 17 Jan 2008 13:06:11 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=26CE92F0-A02B-4FBE-ADFA-F4E9346833A9 prop Code Snippet in VS 2005 <p>You can use the "prop" code snippet in VS 2005 to easily create properties inside a class. So, if you type prop inside a class in VS 2005, you will get something like:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">private</span> <span style="color: #0000FF">int</span> myVar;</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;"><span style="color: #0000FF">public</span> <span style="color: #0000FF">int</span> myProperty</p> <p style="margin: 0px;">{</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; get {<span style="color: #0000FF">return</span> myVar;}</p> <p style="margin: 0px;">&nbsp;&nbsp;&nbsp; set {myVar = Value;}</p> <p style="margin: 0px;">}</p> </div> <p>As you can see, it defaults to an int, but simply type string on line 1 and it will change both "int" fields to strings.&nbsp; Likewise, changing myVar will not only change it on the first line, but also in both locations within the get/set accessors (line 5 and 6).</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Joe</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=WvvR5h"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=WvvR5h" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=mkxdZH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=mkxdZH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=wmHThh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=wmHThh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=Riobhh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=Riobhh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=xEWJRH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=xEWJRH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=VP4Jqh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=VP4Jqh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975548" height="1" width="1"/> http://dotnettipoftheday.org/tips/15941056-2FDF-468B-AB4D-925BE705232A.aspx Thu, 17 Jan 2008 13:04:42 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=15941056-2FDF-468B-AB4D-925BE705232A Easily Creating Properties in VS 2005 (C#) <p>You can use the "prop" attribute to easily create properties in vs 2005 (C#).</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Joe</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=FiD1Jh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=FiD1Jh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=vYCKhH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=vYCKhH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=XJDUfh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=XJDUfh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=xtONDh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=xtONDh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=GmGdaH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=GmGdaH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=uyLGUh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=uyLGUh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975549" height="1" width="1"/> http://dotnettipoftheday.org/tips/D3F9B01A-A171-4A2A-8497-43EA3D3BE423.aspx Tue, 15 Jan 2008 14:05:48 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=D3F9B01A-A171-4A2A-8497-43EA3D3BE423 Automatic Source Code Formatting <p>You can use <code style="color:teal">ctrl k + d</code> to automatically format your html of server code in VS 2005.</p><p style="font-style:italic; margin-top:20px;">submitted by <span style="font-weight:bold">Joe</span></p><div class="feedflare"> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=CJ7HNh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=CJ7HNh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=q35ZWH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=q35ZWH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=MLimph"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=MLimph" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=T72aNh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=T72aNh" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=11CLJH"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=11CLJH" border="0"></img></a> <a href="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?a=8JKBCh"><img src="http://feeds.dotnettipoftheday.org/~f/netTipsTricksCommunity?i=8JKBCh" border="0"></img></a> </div><img src="http://feeds.dotnettipoftheday.org/~r/netTipsTricksCommunity/~4/286975550" height="1" width="1"/> http://dotnettipoftheday.org/tips/224C4FD4-B05B-4D4E-9D93-69D62B60F7EC.aspx Tue, 15 Jan 2008 13:47:21 GMT http://dotnettipoftheday.org/tips/CommentsRss.aspx?tipid=224C4FD4-B05B-4D4E-9D93-69D62B60F7EC Launch DTS from Asp.net page <p><strong>Introduction</strong></p> <p>Data Trasformation Services (DTS) is a tool and set of programmable objects that lets you extract, trasform and consolidate data from various source into various destinations.</p> <p><strong>How to</strong></p> <p>Launch a DTS from Asp.net page is much useful, when you must import some data from disparate sources. First, add reference Microsoft.SqlServer.ManagedDTS to project. Place into the class the follow using:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">using</span> Microsoft.SqlServer.Dts.Runtime;</p> </div> <p>Now, into the page load event place this code:</p> <div style="font-family: Courier New; font-size: 10pt; color: #000000"> <p style="margin: 0px;"><span style="color: #0000FF">string</span> pkgLocation;</p> <p style="margin: 0px;">Package pkgImport;</p> <p style="margin: 0px;">Application appImport;</p> <p style="margin: 0px;">DTSExecResult pkgResults;</p> <p style="margin: 0px;">&nbsp;</p> <p style="margin: 0px;">pkgLocation =