<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" version="2.0">

<channel>
	<title>Sandip's Programming Zen</title>
	
	<link>http://blogsandip.wordpress.com</link>
	<description>experiences while making softwares</description>
	<lastBuildDate>Wed, 04 Nov 2009 09:21:26 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain="blogsandip.wordpress.com" port="80" path="/?rsscloud=notify" registerProcedure="" protocol="http-post" />
<image>
		<url>http://www.gravatar.com/blavatar/08249e348d6e32736441a9befbcef6d5?s=96&amp;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Sandip's Programming Zen</title>
		<link>http://blogsandip.wordpress.com</link>
	</image>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/SandipsBlog" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed</title>
		<link>http://blogsandip.wordpress.com/2009/11/04/multiple-connections-to-a-server-or-shared-resource-by-the-same-user-using-more-than-one-user-name-are-not-allowed/</link>
		<comments>http://blogsandip.wordpress.com/2009/11/04/multiple-connections-to-a-server-or-shared-resource-by-the-same-user-using-more-than-one-user-name-are-not-allowed/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 09:21:26 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[connections]]></category>
		<category><![CDATA[Lan]]></category>
		<category><![CDATA[Network]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/11/04/multiple-connections-to-a-server-or-shared-resource-by-the-same-user-using-more-than-one-user-name-are-not-allowed/</guid>
		<description><![CDATA[multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed

This message will come when you have already connected to a network machine earlier using some credential and now you are trying to access the same machine using a different set of credentials. The reason [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=160&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><blockquote><h6>multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed</h6>
</blockquote>
<p>This message will come when you have already connected to a network machine earlier using some credential and now you are trying to access the same machine using a different set of credentials. The reason is, windows keep the connection open once we open a network path using a particular credential and does not close until we shutdown. </p>
<p>Solution is we remove those connections manually and a simple trick is following command which deletes all “saved” connections:</p>
<p>net use * /delete</p>
<p>Or, you can delete a specific by using :</p>
<p>net use <a href="//\\192.168.1.100">\\192.168.1.100</a> /delete</p>
Posted in Windows Tagged: connections, Lan, Network <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/160/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/160/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/160/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=160&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/11/04/multiple-connections-to-a-server-or-shared-resource-by-the-same-user-using-more-than-one-user-name-are-not-allowed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>C# Winforms: Sending an email with attachment</title>
		<link>http://blogsandip.wordpress.com/2009/10/17/c-winforms-sending-an-email-with-attachment/</link>
		<comments>http://blogsandip.wordpress.com/2009/10/17/c-winforms-sending-an-email-with-attachment/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 04:22:07 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/10/17/c-winforms-sending-an-email-with-attachment/</guid>
		<description><![CDATA[Sending an email from C# winforms application is exactly same as we do in webapps using System.Net.Mail namespace. Here is a sample code which sends out an email with an attachment (again it is not specific to winforms can be used in webapps as it is).
 
MailMessage msg = new MailMessage();     [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=159&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Sending an email from C# winforms application is exactly same as we do in webapps using System.Net.Mail namespace. Here is a sample code which sends out an email with an attachment (again it is not specific to winforms can be used in webapps as it is).</p>
<p> <code>
<p>MailMessage msg = new MailMessage();      <br />SmtpClient client;       <br />Attachment attach = new Attachment(filepath); </p>
<p>if (varEmailID.IndexOf(',') &gt; 0)      <br />{       <br />&#160;&#160;&#160; string[] iDs;       <br />&#160;&#160;&#160; iDs = varEmailID.Split(',');       <br />&#160;&#160;&#160; for (int i = 0; i &lt;= iDs.Length - 1; i++)       <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; msg.To.Add(new MailAddress(iDs.GetValue(i).ToString()));       <br />&#160;&#160;&#160; }       <br />}       <br />else       <br />{       <br />&#160;&#160;&#160; msg.To.Add(new MailAddress(varEmailID));       <br />} </p>
<p>msg.Attachments.Add(attach);      <br />msg.Subject = varSubject;       <br />msg.Body = varBody;       <br />msg.IsBodyHtml = false;       <br />msg.Priority = MailPriority.Normal; </p>
<p>string FromEmail = ConfigurationSettings.AppSettings[&quot;SystemMailID&quot;];      <br />string SmtpServer = ConfigurationSettings.AppSettings[&quot;SmtpServer&quot;];       <br />string UserName = ConfigurationSettings.AppSettings[&quot;UserName&quot;];       <br />string Password = ConfigurationSettings.AppSettings[&quot;Password&quot;];&#160; <br />client = new SmtpClient(SmtpServer);       <br />client.UseDefaultCredentials = false;       <br />System.Net.NetworkCredential creds = new System.Net.NetworkCredential(UserName, Password);       <br />client.Credentials = creds; </p>
<p>msg.From = new MailAddress(FromEmail); </p>
<p>client.Send(msg);</p>
<p></code></p>
Posted in .Net, Programming Tagged: C#, WinForms <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/159/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=159&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/10/17/c-winforms-sending-an-email-with-attachment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>LINQtoSQL : Not looking good in big project</title>
		<link>http://blogsandip.wordpress.com/2009/10/15/linqtosql-not-looking-good-in-big-project/</link>
		<comments>http://blogsandip.wordpress.com/2009/10/15/linqtosql-not-looking-good-in-big-project/#comments</comments>
		<pubDate>Thu, 15 Oct 2009 11:06:34 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[dbml]]></category>
		<category><![CDATA[linqtosql]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/10/15/linqtosql-not-looking-good-in-big-project/</guid>
		<description><![CDATA[Having more than 150 tables and even more SPs in a database and then using LinqToSql for that is proving to be a bottleneck.&#160; 
LinqToSql is an awesome technology but working in a team of more than 5 developers, all trying to update a single dbml at the same time is not a good idea. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=158&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Having more than 150 tables and even more SPs in a database and then using LinqToSql for that is proving to be a bottleneck.&#160; </p>
<p>LinqToSql is an awesome technology but working in a team of more than 5 developers, all trying to update a single dbml at the same time is not a good idea. You won’t notice this while working on a team of 1 or 2 developers , I still think subsonic or NHibernate would have been a better solution at least for the reason being they generate separate class files for each entity.</p>
Posted in .Net, Programming Tagged: dbml, linqtosql <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/158/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/158/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/158/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=158&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/10/15/linqtosql-not-looking-good-in-big-project/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>New in Asp.Net 4 : URL Routing in Webforms</title>
		<link>http://blogsandip.wordpress.com/2009/10/13/new-in-asp-net-4-url-routing-in-webforms/</link>
		<comments>http://blogsandip.wordpress.com/2009/10/13/new-in-asp-net-4-url-routing-in-webforms/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 09:32:41 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/10/13/new-in-asp-net-4-url-routing-in-webforms/</guid>
		<description><![CDATA[Asp.Net 4 (aka Framework 4.0 ) with VS 2010 now supports URL routing for webforms. 
It would be a cool thing since Asp.net MVC was already supporting it out of box and this is just a sign that webforms are going to be a supported as prime platform for developments by MS.
Check here for more [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=156&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Asp.Net 4 (aka Framework 4.0 ) with VS 2010 now supports URL routing for webforms. </p>
<p>It would be a cool thing since Asp.net MVC was already supporting it out of box and this is just a sign that webforms are going to be a supported as prime platform for developments by MS.</p>
<p>Check <a href="http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx" target="_blank">here</a> for more details.</p>
Posted in .Net, Asp.Net, Programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/156/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/156/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/156/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=156&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/10/13/new-in-asp-net-4-url-routing-in-webforms/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>Sending Async Email in Asp.Net</title>
		<link>http://blogsandip.wordpress.com/2009/10/13/sending-async-email-in-asp-net/</link>
		<comments>http://blogsandip.wordpress.com/2009/10/13/sending-async-email-in-asp-net/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 09:26:38 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Asp.Net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/10/13/sending-async-email-in-asp-net/</guid>
		<description><![CDATA[Found an interesting piece of code here.
When sending an email in your ASP.NET application there are times when you do not want the user experience to slow just to wait for an email to be sent.&#160; The code sample below is how to send a System.Net.Mail.MailMessage asynchronously so that the current thread can continue while [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=155&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Found an interesting piece of code <a href="http://weblogs.asp.net/jeffwids/archive/2009/10/12/asynchronously-sending-a-system-net-mail-mailmessage-in-c.aspx" target="_blank">here</a>.</p>
<blockquote><p>When sending an email in your ASP.NET application there are times when you do not want the user experience to slow just to wait for an email to be sent.&#160; The code sample below is how to send a System.Net.Mail.MailMessage asynchronously so that the current thread can continue while a secondary thread sends the email. </p>
<p>public static void SendEmail(System.Net.Mail.MailMessage m)     <br />{      <br />&#160;&#160;&#160; SendEmail(m, true);      <br />}</p>
<p>public static void SendEmail(System.Net.Mail.MailMessage m, Boolean Async)     <br />{</p>
<p>&#160;&#160;&#160; System.Net.Mail.SmtpClient smtpClient = null;</p>
<p>&#160;&#160;&#160; smtpClient = new System.Net.Mail.SmtpClient(&quot;localhost&quot;);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (Async)     <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; SendEmailDelegate sd = new SendEmailDelegate(smtpClient.Send);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; AsyncCallback cb = new AsyncCallback(SendEmailResponse);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; sd.BeginInvoke(m, cb, sd);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; smtpClient.Send(m);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }      <br />}</p>
<p>private delegate void SendEmailDelegate(System.Net.Mail.MailMessage m);</p>
<p>private static void SendEmailResponse(IAsyncResult ar)     <br />{      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; SendEmailDelegate sd = (SendEmailDelegate)(ar.AsyncState);</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; sd.EndInvoke(ar);     <br />}</p>
<p>To use this just call the SendEmail() method with System.Net.Mail.MailMessage object.</p>
</blockquote>
Posted in .Net, Asp.Net, Programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/155/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/155/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/155/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=155&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/10/13/sending-async-email-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>C# : Resize image in Picture Box for Best fit</title>
		<link>http://blogsandip.wordpress.com/2009/09/17/c-resize-image-in-picture-box-for-best-fit/</link>
		<comments>http://blogsandip.wordpress.com/2009/09/17/c-resize-image-in-picture-box-for-best-fit/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 11:27:38 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[WinForms]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/09/17/c-resize-image-in-picture-box-for-best-fit/</guid>
		<description><![CDATA[Got a useful piece of here which I have implemented in following way to make a image preview form.
&#160;&#160;&#160; private void frmPreview_Load(object sender, EventArgs e)      &#160;&#160;&#160; {       &#160;&#160;&#160;&#160;&#160;&#160;&#160; try       &#160;&#160;&#160;&#160;&#160;&#160;&#160; { 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pboxMain.Image = Image.FromFile(_imagePath);    [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=154&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Got a useful piece of <a href="http://www.devhood.com/Tutorials/tutorial_details.aspx?tutorial_id=447" target="_blank">here</a> which I have implemented in following way to make a image preview form.</p>
<p align="left"><em>&#160;&#160;&#160; private void frmPreview_Load(object sender, EventArgs e)      <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; try       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; { </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pboxMain.Image = Image.FromFile(_imagePath);      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; pboxMain.Tag = Image.FromFile(_imagePath);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch(Exception ex)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Log.Error(ex);&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160; private void btFit_Click(object sender, EventArgs e)      <br />&#160;&#160;&#160; { </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (btFit.Text == &quot;Fit to Screen&quot;)      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; handleFitToWindow(true);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; btFit.Text = &quot;Actual Size&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; else       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; handleFitToWindow(false);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; btFit.Text = &quot;Fit to Screen&quot;;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }</em></p>
<p align="left"><em>&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160; private void handleFitToWindow(bool doFit)      <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; try       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Don&#8217;t perform any operation if no image is loaded. */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (this.pboxMain.Tag != null)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (doFit)&#160; /* We&#8217;re fitting it to the window, and centering it. */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Create a temporary Image. </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Always work from the original image, stored in the Tag.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Image tempImage = (Image)this.pboxMain.Tag; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Calculate the dimensions necessary for an image to fit. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Size fitImageSize = this.getScaledImageDimensions(       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; tempImage.Width, tempImage.Height, this.pboxMain.Width, this.pboxMain.Height); </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Create a new Bitmap from the original image with the new dimensions. </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * The constructor for the Bitmap object automatically scales as necessary.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Bitmap imgOutput = new Bitmap(tempImage, fitImageSize.Width, fitImageSize.Height); </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Clear any existing image in the PictureBox. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.Image = null; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* When fitting the image to the window, we want to keep it centered. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.SizeMode = PictureBoxSizeMode.CenterImage; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Finally, set the Image property to point to the new, resized image. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.Image = imgOutput;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else&#160; /* Restore the image to its original size */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Clear any existing image int he PictureBox. */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.Image = null; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Set the resize more to Normal; this will place the image </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * in the upper left-hand corner, clipping the image as required.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.SizeMode = PictureBoxSizeMode.Normal; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Finally, set the Image property to point to the original image. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; this.pboxMain.Image = (Image)this.pboxMain.Tag;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; catch (System.Exception e)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Console.WriteLine(e);       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160; private Size getScaledImageDimensions(      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; int currentImageWidth,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; int currentImageHeight,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; int desiredImageWidth,       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; int desiredImageHeight)       <br />&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* First, we must calculate a multiplier that will be used </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * to get the dimensions of the new, scaled image.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; double scaleImageMultiplier = 0; </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* This multiplier is defined as the ratio of the </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Desired Dimension to the Current Dimension.      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Specifically which dimension is used depends on the larger       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * dimension of the image, as this will be the constraining dimension       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * when we fit to the window.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Determine if Image is Portrait or Landscape. */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (currentImageHeight &gt; currentImageWidth)&#160;&#160;&#160; /* Image is Portrait */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Calculate the multiplier based on the heights. */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (desiredImageHeight &gt; desiredImageWidth)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scaleImageMultiplier = (double)desiredImageWidth / (double)currentImageWidth;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scaleImageMultiplier = (double)desiredImageHeight / (double)currentImageHeight;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; else /* Image is Landscape */      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Calculate the multiplier based on the widths. */       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; if (desiredImageHeight &gt; desiredImageWidth)       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scaleImageMultiplier = (double)desiredImageWidth / (double)currentImageWidth;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; else      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; {       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; scaleImageMultiplier = (double)desiredImageHeight / (double)currentImageHeight;       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; }       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160; } </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; /* Generate and return the new scaled dimensions. </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * Essentially, we multiply each dimension of the original image      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * by the multiplier calculated above to yield the dimensions       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * of the scaled image. The scaled image can be larger or smaller       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; * than the original.       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; */ </em></p>
<p align="left"><em>&#160;&#160;&#160;&#160;&#160;&#160;&#160; return new Size(      <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (int)(currentImageWidth * scaleImageMultiplier),       <br />&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; (int)(currentImageHeight * scaleImageMultiplier));       <br />&#160;&#160;&#160; } </em></p>
<p align="left"><em>}</em></p>
Posted in .Net, Programming Tagged: C#, WinForms <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/154/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/154/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/154/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=154&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/09/17/c-resize-image-in-picture-box-for-best-fit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>How to: Set checked property of CheckedListBox using code</title>
		<link>http://blogsandip.wordpress.com/2009/09/12/how-to-set-checked-property-of-checkedlistbox-using-code/</link>
		<comments>http://blogsandip.wordpress.com/2009/09/12/how-to-set-checked-property-of-checkedlistbox-using-code/#comments</comments>
		<pubDate>Sat, 12 Sep 2009 07:27:51 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/09/12/how-to-set-checked-property-of-checkedlistbox-using-code/</guid>
		<description><![CDATA[CheckedListBox does not have a straight forward way of making checkbox selected using code, so here is some code which may save some Google searches.
For example if you have a data bound CheckedListBox and you need to make some of the items selected by iterating through them then we can do as follows:



For Each dtr [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=149&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>CheckedListBox does not have a straight forward way of making checkbox selected using code, so here is some code which may save some Google searches.</p>
<p>For example if you have a data bound CheckedListBox and you need to make some of the items selected by iterating through them then we can do as follows:</p>
<p><code><br />
</code></p>
<p><code></p>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">For Each dtr As DataRow In dtpack.Rows</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">For i As Integer = 0 To cmbServices.Items.Count - 1</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">If DirectCast(cmbServices.Items(i), DataRowView)("ID") = dtr("ID") Then</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">cmbServices.SetItemCheckState(i, CheckState.Checked)</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">End If</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Next</div>
<div id="_mcePaste" style="position:absolute;left:-10000px;top:0;width:1px;height:1px;">Next</div>
<p>For Each dtr As DataRow In dt.Rows</p>
<p>For i As Integer = 0 To clbServices.Items.Count - 1</p>
<p>If DirectCast(clbServices.Items(i), DataRowView)("ID") = dtr("ID") Then</p>
<p><strong>clbServices.SetItemCheckState(i, CheckState.Checked)</strong></p>
<p>End If</p>
<p>Next</p>
<p>Next</p>
<p></code></p>
Posted in .Net, Programming  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/149/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/149/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/149/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=149&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/09/12/how-to-set-checked-property-of-checkedlistbox-using-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>Installed Windows 7 RC in dual boot mode</title>
		<link>http://blogsandip.wordpress.com/2009/05/06/installed-windows-7-in-dual-boot-mode/</link>
		<comments>http://blogsandip.wordpress.com/2009/05/06/installed-windows-7-in-dual-boot-mode/#comments</comments>
		<pubDate>Wed, 06 May 2009 02:37:22 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[Softwares]]></category>
		<category><![CDATA[Partition Software]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/?p=144</guid>
		<description><![CDATA[I just finished installing Windows 7 on my home laptop in dual boot mode with Windows XP.
To partition my hard drive, I used Partition Master 3.5 Home Edition, it&#8217;s a lesser known freeware but it works seamlessly.
Windows 7 has easier and quicker installation process , plus it got all the hardware drivers on my machine. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=144&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I just finished installing Windows 7 on my home laptop in dual boot mode with Windows XP.</p>
<p>To partition my hard drive, I used <a href="http://www.partition-tool.com/personal.htm" target="_blank">Partition Master 3.5 Home Edition</a>, it&#8217;s a lesser known freeware but it works seamlessly.</p>
<p>Windows 7 has easier and quicker installation process , plus it got all the hardware drivers on my machine. . It certainly boots up faster than Vista (which was my biggest headache using it). Looks promising to me.</p>
<p><!--Session data--></p>
<p><!--Session data--></p>
Posted in Softwares Tagged: Partition Software, Windows 7 <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=144&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/05/06/installed-windows-7-in-dual-boot-mode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>Cross-Domain Calls with IFrames</title>
		<link>http://blogsandip.wordpress.com/2009/04/29/cross-domain-calls-with-iframes/</link>
		<comments>http://blogsandip.wordpress.com/2009/04/29/cross-domain-calls-with-iframes/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 16:37:33 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[AJAX]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/?p=138</guid>
		<description><![CDATA[We know that cross domain ajax calls are not possible from javascript, but come&#8217;on we live in virtual world and every law can be bent if we can (remember Morpheus from ultra cool Matrix   )
Ok, I found  here on this nice guy&#8217;s blog under Cross-Domain Communication with IFrames.
I have actually used it and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=138&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>We know that cross domain ajax calls are not possible from javascript, but come&#8217;on we live in virtual world and every law can be bent if we can (remember Morpheus from ultra cool Matrix <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  )</p>
<p>Ok, I found  here on this nice guy&#8217;s blog under <a href="http://softwareas.com/cross-domain-communication-with-iframes">Cross-Domain Communication with IFrames</a>.</p>
<p>I have actually used it and it works like a charm. I made a simple javascript function to get the anchor values , actually I used anchors to pass values using URL as if passing URL variable.</p>
<p>For example if I want to pass one variable then I would do :</p>
<p>http://www.yourdomain.com#action=foo#</p>
<p>For two variables :</p>
<p>http://www.yourdomain.com#action=foo#action2=foo2#</p>
<p>Two JS function, one for getting anchor value and second for resetting URL to it&#8217;s original form.</p>
<p>function getAnchor(name) {</p>
<p>url = window.location.href;<br />
var varlen = name.length + 2;<br />
var start = url.indexOf(&#8220;#&#8221; + name) + varlen;<br />
var length = url.indexOf(&#8220;#&#8221;, start) &#8211; start;</p>
<p>var value = url.substr(start, length);<br />
return value;<br />
}</p>
<p>function resetAnchor() {<br />
url = window.location.href;<br />
var hash = url.indexOf(&#8220;#&#8221;)<br />
if (hash &gt;= 0) {<br />
url = url.substr(0, hash);<br />
window.location.href = url + &#8220;#&#8221;;<br />
}<br />
}</p>
<p>I would be happy to help if you have any troubles.</p>
<p><!--Session data--></p>
Posted in Internet, Javascript Tagged: AJAX, Javascript <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/138/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/138/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/138/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=138&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/04/29/cross-domain-calls-with-iframes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>
	</item>
		<item>
		<title>Maximize Firefox space for Gmail</title>
		<link>http://blogsandip.wordpress.com/2009/04/29/maximize-firefox-space-for-gmail/</link>
		<comments>http://blogsandip.wordpress.com/2009/04/29/maximize-firefox-space-for-gmail/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 16:10:42 +0000</pubDate>
		<dc:creator>Sandip</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[productivity]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Gmail]]></category>

		<guid isPermaLink="false">http://blogsandip.wordpress.com/2009/04/29/maximize-firefox-space-for-gmail/</guid>
		<description><![CDATA[Gmail in Firefox is my primary work and personal email client, so I try to make as much space available as possible for Gmail.
I use Hide Menubar add-on which hides the main menubar, then I hide all other extra toolbars and keeping only Address bar (which minimum you need anyways).
Then, recently I found Gmail Compactor [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=135&subd=blogsandip&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Gmail in Firefox is my primary work and personal email client, so I try to make as much space available as possible for Gmail.</p>
<p>I use <a href="https://addons.mozilla.org/en-US/firefox/addon/4762" target="_blank">Hide Menubar</a> add-on which hides the main menubar, then I hide all other extra toolbars and keeping only Address bar (which minimum you need anyways).</p>
<p>Then, recently I found <a href="http://www.pavelgutin.com/page/GMail-Compactor-greasemonkey-script.aspx" target="_blank">Gmail Compactor</a> Add-On which make further space available for Gmail and make it look little better than standard interface. Make sure you have <a href="https://addons.mozilla.org/en-US/firefox/addon/748" target="_blank">Greasemonkey </a>add-on installed before you try.</p>
<p><!--Session data--></p>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" src="http://img.zemanta.com/pixy.gif?x-id=acd64b24-8237-845f-b849-7999fcdd2c42" alt="" /></div>
<p><!--Session data--></p>
<p><!--Session data--></p>
Posted in Internet, productivity Tagged: Firefox, Gmail, Internet <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/blogsandip.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/blogsandip.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/blogsandip.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/blogsandip.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/blogsandip.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/blogsandip.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/blogsandip.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/blogsandip.wordpress.com/135/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/blogsandip.wordpress.com/135/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/blogsandip.wordpress.com/135/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=blogsandip.wordpress.com&blog=2605594&post=135&subd=blogsandip&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://blogsandip.wordpress.com/2009/04/29/maximize-firefox-space-for-gmail/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/ff4a5861609fc72f0a374e9936707364?s=96&amp;d=identicon&amp;r=G" medium="image">
			<media:title type="html">Sandip</media:title>
		</media:content>

		<media:content url="http://img.zemanta.com/pixy.gif?x-id=acd64b24-8237-845f-b849-7999fcdd2c42" medium="image" />
	</item>
	</channel>
</rss>
