<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>theDeSilva.com</title>
	<atom:link href="http://www.thedesilva.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thedesilva.com</link>
	<description>Andrew de Silva</description>
	<lastBuildDate>Tue, 26 Apr 2011 20:24:19 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Search process that has locked a file on Windows</title>
		<link>http://www.thedesilva.com/2011/04/search-process-that-has-locked-a-file-on-windows/</link>
		<comments>http://www.thedesilva.com/2011/04/search-process-that-has-locked-a-file-on-windows/#comments</comments>
		<pubDate>Tue, 26 Apr 2011 20:24:19 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=228</guid>
		<description><![CDATA[<br/>To know which process has locked a file, you may use Process Explorer. It can shows you information about which handles and DLLs processes have opened or loaded the file that is locked. Click the Find menu, and choose Find Handle or DLL&#8230; Type the file name (this is the name of the file that [...]]]></description>
				<content:encoded><![CDATA[<br/><p>To know which process has locked a file, you may use <a href="http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx">Process Explorer</a>. It can shows you information about which handles and DLLs processes have opened or loaded the file that is locked.</p>
<ol>
<li>Click the Find menu, and choose Find Handle or DLL&#8230;</li>
<li>Type the file name (this is the name of the file that you cannot access/delete)</li>
<li>After typing the search phrase, click the Search button</li>
<li>Once it returns the list of application that is accessing your file you can either close the application manually or use Process Explorer to terminate it</li>
</ol>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2011/04/search-process-that-has-locked-a-file-on-windows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Firefox &#8211; Flash Debugger Player Crash</title>
		<link>http://www.thedesilva.com/2011/02/firefox-flash-debugger-player-crash/</link>
		<comments>http://www.thedesilva.com/2011/02/firefox-flash-debugger-player-crash/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 20:59:40 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=225</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash.png" width="128" height="128" alt="Flash" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/>If you are using the Flash Debugger Player like I do to debug your work , you will soon to realized that the newer versions of Firefox tends to crash whenever the debugger prompts a warning. This is happening because Firefox will kill the debug session and cause it to crash Firefox. Here&#8217;s a solution [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash.png" width="128" height="128" alt="Flash" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/><p>If you are using the Flash Debugger Player like I do to debug your work , you will soon to realized that the newer versions of Firefox tends to crash whenever the debugger prompts a warning. This is happening because Firefox will kill the debug session and cause it to crash Firefox. Here&#8217;s a solution to it</p>
<p>1. Goto addresss bar and type in about:config<br />
2. Click on the I’ll be careful, I promise button.<br />
3. Type dom.ipc.plugins.timeoutSecs<br />
4. Find value and double click and change the value to -1</p>
<p>Viola and now your flash debugger player will stop crashing each time it throws a warning as you have changed the default timeout value from 45 to unlimited.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2011/02/firefox-flash-debugger-player-crash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Find your Base Path / Local Directory using VB.NET</title>
		<link>http://www.thedesilva.com/2010/09/find-your-base-path-local-directory-using-vb-net/</link>
		<comments>http://www.thedesilva.com/2010/09/find-your-base-path-local-directory-using-vb-net/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 04:31:03 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[.NET]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=208</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/>Here&#8217;s a fast way to find what&#8217;s your application base path. Why do you need to do this ? This is extemely handy when you are trying to figure where your files are hosted on the hosting company. It&#8217;s not always easy to figure out this path. Response.Write(System.AppDomain.CurrentDomain.BaseDirectory)]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/><p>Here&#8217;s a fast way to find what&#8217;s your application base path. Why do you need to do this ? This is extemely handy when you are trying to figure where your files are hosted on the hosting company. It&#8217;s not always easy to figure out this path.</p>
<pre lang="vb.net" line="0">
Response.Write(System.AppDomain.CurrentDomain.BaseDirectory)
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/09/find-your-base-path-local-directory-using-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ReferenceError: Error #1069: Property startDrag not found on flash.text.TextField</title>
		<link>http://www.thedesilva.com/2010/08/referenceerror-error-1069-property-startdrag-not-found-on-flash-text-textfield/</link>
		<comments>http://www.thedesilva.com/2010/08/referenceerror-error-1069-property-startdrag-not-found-on-flash-text-textfield/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 19:22:43 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[error 1069]]></category>
		<category><![CDATA[startdrag]]></category>
		<category><![CDATA[stopdrag]]></category>
		<category><![CDATA[textfield]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=201</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash.png" width="128" height="128" alt="Flash" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/>Here&#8217;s a quick solution to the error ReferenceError: Error #1069: Property startDrag not found on flash.text.TextField . This normally happens when you are trying to get the TextField to drag. &#160; textField.addEventListener&#40;MouseEvent.MOUSE_DOWN, drag&#41;; textField.addEventListener&#40;MouseEvent.MOUSE_UP, drop&#41;; &#160; // by setting mouseChildren = false it makes the drag function to use the container // of the movie [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flash.png" width="128" height="128" alt="Flash" title="Flash" /><img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/><p>Here&#8217;s a quick solution to the error ReferenceError: Error #1069: Property startDrag not found on flash.text.TextField .  This normally happens when you are trying to get the TextField to drag.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="actionscript" style="font-family:monospace;">&nbsp;
<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_DOWN</span>, drag<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MouseEvent.<span style="color: #006600;">MOUSE_UP</span>, drop<span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">// by setting mouseChildren = false it makes the drag function to use the container </span>
<span style="color: #808080; font-style: italic;">// of the movie clip rather than the compenent within the movieclip. </span>
<span style="color: #808080; font-style: italic;">// This is where the ReferenceError: Error #1069: Property startDrag </span>
<span style="color: #808080; font-style: italic;">// not found on flash.text.TextField is coming from </span>
&nbsp;
<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">mouseChildren</span> = <span style="color: #000000; font-weight: bold;">false</span>;
<span style="color: #0066CC;">textField</span>.<span style="color: #006600;">text1</span>.<span style="color: #0066CC;">selectable</span> = <span style="color: #000000; font-weight: bold;">false</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> drag<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">startDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> drop<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:MouseEvent<span style="color: #66cc66;">&#41;</span>:<span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
  	<span style="color: #0066CC;">e</span>.<span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">stopDrag</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/08/referenceerror-error-1069-property-startdrag-not-found-on-flash-text-textfield/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Disable selection on browser using Javascript</title>
		<link>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/</link>
		<comments>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/#comments</comments>
		<pubDate>Wed, 10 Mar 2010 21:48:23 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[disable select]]></category>
		<category><![CDATA[disable selection]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=199</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo.png" width="120" height="120" alt="Javascript" title="Javascript" /><br/>Here&#8217;s a quick way to disable selection on browsers using Javascript. Helpful if you don&#8217;t want somebody to select a bunch of text and copy and paste. 1 2 3 4 5 6 7 8 9 10 11 12 13 window.onload = function&#40;&#41; &#123; disableSelection&#40;document.body&#41; &#125; &#160; function disableSelection&#40;target&#41;&#123; if &#40;typeof target.onselectstart!=&#34;undefined&#34;&#41; //IE target.onselectstart=function&#40;&#41;&#123;return false&#125; [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo.png" width="120" height="120" alt="Javascript" title="Javascript" /><br/><p>Here&#8217;s a quick way to disable selection on browsers using Javascript. Helpful if you don&#8217;t want somebody to select a bunch of text and copy and paste.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">onload</span> <span style="color: #339933;">=</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	disableSelection<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">body</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> disableSelection<span style="color: #009900;">&#40;</span>target<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> target.<span style="color: #660066;">onselectstart</span><span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//IE </span>
	target.<span style="color: #660066;">onselectstart</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> target.<span style="color: #660066;">style</span>.<span style="color: #660066;">MozUserSelect</span><span style="color: #339933;">!=</span><span style="color: #3366CC;">&quot;undefined&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #006600; font-style: italic;">//Firefox </span>
	target.<span style="color: #660066;">style</span>.<span style="color: #660066;">MozUserSelect</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;none&quot;</span>
<span style="color: #000066; font-weight: bold;">else</span> <span style="color: #006600; font-style: italic;">//All other ie: Opera</span>
	target.<span style="color: #660066;">onmousedown</span><span style="color: #339933;">=</span><span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#125;</span>
target.<span style="color: #660066;">style</span>.<span style="color: #660066;">cursor</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;default&quot;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/03/disable-selection-on-browser-using-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Batch File to Copy Flex Release Build to Production Server</title>
		<link>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/</link>
		<comments>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 22:19:04 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[batch file]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=194</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/>Here&#8217;s something that I always do when writing any sort of Flex Application. I&#8217;ll write a batch file that would allow me to quickly double click it and copy all of the files on the bin-release folder to the production server. This normally save me a lot of time as I don&#8217;t have to manually [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//flex-icon.png" width="128" height="128" alt="Flex" title="Flex" /><br/><p>Here&#8217;s something that I always do when writing any sort of Flex Application. I&#8217;ll write a batch file that would allow me to quickly double click it and copy all of the files on the bin-release folder to the production server. This normally save me a lot of time as I don&#8217;t have to manually look for the files and copy them to the server.</p>
<p>Here&#8217;s a quick way to create the batch file and edit it to do what you want to ,</p>
<ol>
<li> Open up Notepad in Windows. You can do this by navigating to Start &gt; Programs &gt; Accessories &gt; Notepad, or simply by entering notepad under Start &gt; Run.</li>
<li> Save your file before you start writing any code</li>
<li> Go to File &gt; Save As.</li>
<li> Click on the dropdown box &#8220;Save as type:&#8221; and select &#8220;All files&#8221; instead of Text (*.txt).</li>
<li> Add .bat to the end of your file name before you save. For example copy.bat.</li>
<li> Click on Save.</li>
</ol>
<p>Now a little batch commands to delete the files that exist on the production server first before we copy the files from the bin-release folder to the production server followed by opening the page using the default browser.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="vb" style="font-family:monospace;">REM Delete old production files
del \\production_server_name\production_folder\*.*
REM Copy over <span style="color: #E56717; font-weight: bold;">new</span> production files
copy *.* \\production_server_name\production_folder\
REM <span style="color: #151B8D; font-weight: bold;">Open</span> the location of the file using default browser
start www.production_server.com</pre></td></tr></table></div>

<p>The batch file should be located in the same folder as the files that you want to copy</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/02/batch-file-to-copy-flex-release-build-to-production-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Using cmd.exe with VB.NET &#8211; Process.Start</title>
		<link>http://www.thedesilva.com/2010/01/using-cmd-exe-with-vb-net-process-start/</link>
		<comments>http://www.thedesilva.com/2010/01/using-cmd-exe-with-vb-net-process-start/#comments</comments>
		<pubDate>Thu, 28 Jan 2010 00:04:14 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[command prompt]]></category>
		<category><![CDATA[Process.start]]></category>
		<category><![CDATA[system diagnostics]]></category>
		<category><![CDATA[VB]]></category>
		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=190</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/>Here&#8217;s a quick function to show the use of System.Diagnostic.Process which will allow you to start another application using VB.NET. The example below is used to call svnadmin to create a new repository ( Subversion ) by grabbing the repository name. The function also checks to see whether the directory exist on the file system [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/><p>Here&#8217;s a quick function to show the use of System.Diagnostic.Process which will allow you to start another application using VB.NET. The example below is used to call svnadmin to create a new repository ( Subversion ) by grabbing the repository name. The function also checks to see whether the directory exist on the file system and if it doesn&#8217;t it will start the command prompt svnadmin to create the folder. However if the folder does exist it will nag at you.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">Sub</span> createRepo<span style="color: #000000;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByVal</span> sender <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Object</span>, <span style="color: #0000FF; font-weight: bold;">ByVal</span> e <span style="color: #0000FF; font-weight: bold;">As</span> System<span style="color: #000000;">.</span><span style="color: #000000;">EventArgs</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0000FF; font-weight: bold;">Dim</span> repoName <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span> <span style="color: #000000;">=</span> repoNameInput<span style="color: #000000;">.</span><span style="color: #000000;">Text</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> dirExist <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Boolean</span> <span style="color: #000000;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">If</span> System<span style="color: #000000;">.</span><span style="color: #000000;">IO</span><span style="color: #000000;">.</span><span style="color: #000000;">Directory</span><span style="color: #000000;">.</span><span style="color: #000000;">Exists</span><span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;C:\svn_repository\&quot;</span> <span style="color: #000000;">&amp;</span> repoName<span style="color: #000000;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
            dirExist <span style="color: #000000;">=</span> <span style="color: #0000FF; font-weight: bold;">True</span>
            result<span style="color: #000000;">.</span><span style="color: #000000;">Text</span> <span style="color: #000000;">=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;&lt;font color=&quot;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;red&quot;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;&gt;Repository Already Exist !&lt;/font&gt;&quot;</span>
        <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">If</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #000000;">&#40;</span>repoName<span style="color: #000000;">.</span><span style="color: #000000;">Length</span> <span style="color: #000000;">&lt;&gt;</span> <span style="color: #a52a2a; back-color: #fffacd;">0</span> <span style="color: #0000FF; font-weight: bold;">And</span> dirExist <span style="color: #000000;">=</span> <span style="color: #0000FF; font-weight: bold;">False</span><span style="color: #000000;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
            <span style="color: #0000FF; font-weight: bold;">Dim</span> myProcess <span style="color: #0000FF; font-weight: bold;">As</span> Process <span style="color: #000000;">=</span> Process<span style="color: #000000;">.</span><span style="color: #000000;">Start</span><span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;cmd.exe&quot;</span>, <span style="color: #a52a2a; back-color: #fffacd;">&quot;/k svnadmin create C:\svn_repository\&quot;</span> <span style="color: #000000;">&amp;</span> repoName<span style="color: #000000;">&#41;</span>
&nbsp;
            myProcess<span style="color: #000000;">.</span><span style="color: #000000;">WaitForExit</span><span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">10000</span><span style="color: #000000;">&#41;</span>
            <span style="color: #008000; font-style: italic;">' if the process doesn't complete within</span>
            <span style="color: #008000; font-style: italic;">' 10 seconds, kill it</span>
&nbsp;
            <span style="color: #0000FF; font-weight: bold;">If</span> <span style="color: #0000FF; font-weight: bold;">Not</span> myProcess<span style="color: #000000;">.</span><span style="color: #000000;">HasExited</span> <span style="color: #0000FF; font-weight: bold;">Then</span>
                myProcess<span style="color: #000000;">.</span><span style="color: #000000;">Kill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
            <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">If</span>
&nbsp;
            result<span style="color: #000000;">.</span><span style="color: #000000;">Text</span> <span style="color: #000000;">=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;Respository Created: &quot;</span> _
                <span style="color: #000000;">&amp;</span> myProcess<span style="color: #000000;">.</span><span style="color: #000000;">ExitTime</span> <span style="color: #000000;">&amp;</span> _
                Environment<span style="color: #000000;">.</span><span style="color: #000000;">NewLine</span> <span style="color: #000000;">&amp;</span> _
                <span style="color: #a52a2a; back-color: #fffacd;">&quot;Exit Code (Troubleshooting Purpose): &quot;</span> <span style="color: #000000;">&amp;</span> _
                myProcess<span style="color: #000000;">.</span><span style="color: #000000;">ExitCode</span>
        <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">If</span>
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Sub</span></pre></td></tr></table></div>

<p>You will have to import the following library to have the Process.Start to work.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Imports</span> System<span style="color: #000000;">.</span><span style="color: #000000;">Diagnostics</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/01/using-cmd-exe-with-vb-net-process-start/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET Database query return result as XML</title>
		<link>http://www.thedesilva.com/2010/01/vb-net-database-query-return-result-as-xml/</link>
		<comments>http://www.thedesilva.com/2010/01/vb-net-database-query-return-result-as-xml/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 20:00:31 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[data source]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[DataSet]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=186</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/>A simple VB.NET page that takes a ID variable and return the result as XML page. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/><p>A simple VB.NET page that takes a ID variable and return the result as XML page.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;">&nbsp;
<span style="color: #0000FF; font-weight: bold;">Imports</span> System<span style="color: #000000;">.</span><span style="color: #000000;">IO</span>
<span style="color: #0000FF; font-weight: bold;">Imports</span> System<span style="color: #000000;">.</span><span style="color: #000000;">Xml</span>
<span style="color: #0000FF; font-weight: bold;">Imports</span> System<span style="color: #000000;">.</span><span style="color: #000000;">Data</span>
<span style="color: #0000FF; font-weight: bold;">Imports</span> System<span style="color: #000000;">.</span><span style="color: #000000;">Data</span><span style="color: #000000;">.</span><span style="color: #000000;">SqlClient</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">Partial</span> <span style="color: #0000FF; font-weight: bold;">Class</span> writeXML
    <span style="color: #0000FF; font-weight: bold;">Inherits</span> System<span style="color: #000000;">.</span><span style="color: #000000;">Web</span><span style="color: #000000;">.</span><span style="color: #000000;">UI</span><span style="color: #000000;">.</span><span style="color: #000000;">Page</span>
&nbsp;
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">Protected</span> <span style="color: #0000FF; font-weight: bold;">Sub</span> Page_Load<span style="color: #000000;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByVal</span> sender <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Object</span>, <span style="color: #0000FF; font-weight: bold;">ByVal</span> e <span style="color: #0000FF; font-weight: bold;">As</span> System<span style="color: #000000;">.</span><span style="color: #000000;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">Handles</span> <span style="color: #0000FF; font-weight: bold;">Me</span><span style="color: #000000;">.</span><span style="color: #000000;">Load</span>
        GetXML<span style="color: #000000;">&#40;</span>Request<span style="color: #000000;">.</span><span style="color: #000000;">QueryString</span><span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;pid&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Sub</span>
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">Public</span> <span style="color: #0000FF; font-weight: bold;">Function</span> sqlConnect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">As</span> SqlConnection
        <span style="color: #0000FF; font-weight: bold;">Dim</span> oCn <span style="color: #0000FF; font-weight: bold;">As</span> SqlConnection <span style="color: #000000;">=</span> <span style="color: #0000FF; font-weight: bold;">New</span> SqlConnection<span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;Data Source=xxxx\xxxx; Initial Catalog=tableName; User Id=dbUSERNAME; Password=dbPASSWORD&quot;</span><span style="color: #000000;">&#41;</span>
        <span style="color: #0000FF; font-weight: bold;">Return</span> oCn
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Function</span>
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">Private</span> <span style="color: #0000FF; font-weight: bold;">Function</span> GetDataSet<span style="color: #000000;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByVal</span> strSQL <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span><span style="color: #000000;">&#41;</span> <span style="color: #0000FF; font-weight: bold;">As</span> DataSet
&nbsp;
        <span style="color: #008000; font-style: italic;">'1. Create a connection</span>
        <span style="color: #0000FF; font-weight: bold;">Dim</span> myConnection <span style="color: #0000FF; font-weight: bold;">As</span> SqlConnection <span style="color: #000000;">=</span> sqlConnect<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #008000; font-style: italic;">'2. Create the command object, passing in the SQL string    </span>
        <span style="color: #0000FF; font-weight: bold;">Dim</span> myCommand <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> SqlCommand<span style="color: #000000;">&#40;</span>strSQL, myConnection<span style="color: #000000;">&#41;</span>
&nbsp;
        myConnection<span style="color: #000000;">.</span><span style="color: #000000;">Open</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #008000; font-style: italic;">'3. Create the DataAdapter</span>
        <span style="color: #0000FF; font-weight: bold;">Dim</span> myDataAdapter <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> SqlDataAdapter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        myDataAdapter<span style="color: #000000;">.</span><span style="color: #000000;">SelectCommand</span> <span style="color: #000000;">=</span> myCommand
&nbsp;
&nbsp;
        <span style="color: #008000; font-style: italic;">'4. Populate the DataSet and close the connection</span>
        <span style="color: #0000FF; font-weight: bold;">Dim</span> myDataSet <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> DataSet<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        myDataAdapter<span style="color: #000000;">.</span><span style="color: #000000;">Fill</span><span style="color: #000000;">&#40;</span>myDataSet<span style="color: #000000;">&#41;</span>
        myConnection<span style="color: #000000;">.</span><span style="color: #000066;">Close</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #008000; font-style: italic;">'Return the DataSet</span>
        <span style="color: #0000FF; font-weight: bold;">Return</span> myDataSet
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Function</span>
&nbsp;
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">Public</span> <span style="color: #0000FF; font-weight: bold;">Sub</span> GetXML<span style="color: #000000;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByVal</span> id <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> sqlCommand <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span>
&nbsp;
        sqlCommand <span style="color: #000000;">=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;SELECT column1, column2  &quot;</span>
        sqlCommand <span style="color: #000000;">&amp;=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;FROM tableName &quot;</span>
        sqlCommand <span style="color: #000000;">&amp;=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;WHERE id = '&quot;</span> <span style="color: #000000;">&amp;</span> id <span style="color: #000000;">&amp;</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;';  &quot;</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> retrievedDataSet <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> DataSet
        retrievedDataSet <span style="color: #000000;">=</span> GetDataSet<span style="color: #000000;">&#40;</span>sqlCommand<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> xmlDocument <span style="color: #0000FF; font-weight: bold;">As</span> XmlDocument <span style="color: #000000;">=</span> <span style="color: #0000FF; font-weight: bold;">New</span> XmlDocument
        xmlDocument<span style="color: #000000;">.</span><span style="color: #000000;">LoadXml</span><span style="color: #000000;">&#40;</span>retrievedDataSet<span style="color: #000000;">.</span><span style="color: #000000;">GetXml</span><span style="color: #000000;">&#41;</span>
&nbsp;
&nbsp;
        Response<span style="color: #000000;">.</span><span style="color: #000000;">Clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        Response<span style="color: #000000;">.</span><span style="color: #000000;">ContentType</span> <span style="color: #000000;">=</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;text/xml&quot;</span>
        Response<span style="color: #000000;">.</span><span style="color: #000000;">ContentEncoding</span> <span style="color: #000000;">=</span> Encoding<span style="color: #000000;">.</span><span style="color: #000000;">UTF8</span>
        Response<span style="color: #000000;">.</span><span style="color: #000000;">Write</span><span style="color: #000000;">&#40;</span>xmlDocument<span style="color: #000000;">.</span><span style="color: #000000;">InnerXml</span><span style="color: #000000;">&#41;</span>
        Response<span style="color: #000000;">.</span><span style="color: #000000;">Flush</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
        Response<span style="color: #000000;">.</span><span style="color: #0000FF; font-weight: bold;">End</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Sub</span>
&nbsp;
<span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Class</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/01/vb-net-database-query-return-result-as-xml/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Greasemonkey &#8211; Add button to page to call function within GreaseMonkey</title>
		<link>http://www.thedesilva.com/2010/01/greasemonkey-add-button-to-page-to-call-function-within-greasemonkey/</link>
		<comments>http://www.thedesilva.com/2010/01/greasemonkey-add-button-to-page-to-call-function-within-greasemonkey/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 22:14:51 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[button]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[greasemonkey]]></category>
		<category><![CDATA[onclick]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=180</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo.png" width="120" height="120" alt="Javascript" title="Javascript" /><br/>Here&#8217;s a really quick way to add a button into an existing page and then have the button call a function that is within greasemonkey script. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 &#160; window.addEventListener&#40;&#34;load&#34;, function&#40;e&#41; &#123; addButton&#40;&#41;; &#125;, false&#41;; &#160; function addButton&#40;&#41;&#123; [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//java-duke-logo.png" width="120" height="120" alt="Javascript" title="Javascript" /><br/><p>Here&#8217;s a really quick way to add a button into an existing page and then have the button call a function that is within greasemonkey script.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">&nbsp;
window.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;load&quot;</span><span style="color: #339933;">,</span> <span style="color: #000066; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  addButton<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> addButton<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000066; font-weight: bold;">var</span> buttonElems <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'buttonElementName'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
 buttonElems<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> buttonElems<span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;input id=&quot;greasemonkeyButton&quot; type=&quot;button&quot; value=&quot;Call Greasemonkey Function&quot; /&gt;'</span>
addButtonListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> addButtonListener<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
  <span style="color: #000066; font-weight: bold;">var</span> button <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;greasemonkeyButton&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  button.<span style="color: #660066;">addEventListener</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</span>doMonkey<span style="color: #339933;">,</span><span style="color: #003366; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">function</span> doMonkey<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	<span style="color: #006600; font-style: italic;">//do something</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/01/greasemonkey-add-button-to-page-to-call-function-within-greasemonkey/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Resize image using VB.NET</title>
		<link>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/</link>
		<comments>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 19:35:39 +0000</pubDate>
		<dc:creator>Andrew de Silva</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[image height]]></category>
		<category><![CDATA[image width]]></category>
		<category><![CDATA[resize image]]></category>
		<category><![CDATA[VB]]></category>

		<guid isPermaLink="false">http://www.thedesilva.com/?p=178</guid>
		<description><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/>Here&#8217;s a quick function to resize image using VB.NET 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Sub ResizeImage&#40;ByVal dir As String, ByVal fileName As String, ByVal percentResize As Double&#41; 'following code resizes picture [...]]]></description>
				<content:encoded><![CDATA[<img src="http://www.thedesilva.com/img/category_icon//VisualStudio.png" width="120" height="120" alt=".NET" title=".NET" /><br/><p>Here&#8217;s a quick function to resize image using VB.NET</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
</pre></td><td class="code"><pre class="vbnet" style="font-family:monospace;"><span style="color: #0000FF; font-weight: bold;">Sub</span> ResizeImage<span style="color: #000000;">&#40;</span><span style="color: #0000FF; font-weight: bold;">ByVal</span> dir <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span>, <span style="color: #0000FF; font-weight: bold;">ByVal</span> fileName <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">String</span>, <span style="color: #0000FF; font-weight: bold;">ByVal</span> percentResize <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Double</span><span style="color: #000000;">&#41;</span>
        <span style="color: #008000; font-style: italic;">'following code resizes picture to fit</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> bm <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> Bitmap<span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;C:\&quot;</span> <span style="color: #000000;">&amp;</span> dir <span style="color: #000000;">&amp;</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;\&quot;</span> <span style="color: #000000;">&amp;</span> fileName<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> width <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Integer</span> <span style="color: #000000;">=</span> bm<span style="color: #000000;">.</span><span style="color: #000000;">Width</span> <span style="color: #000000;">-</span> <span style="color: #000000;">&#40;</span>bm<span style="color: #000000;">.</span><span style="color: #000000;">Width</span> <span style="color: #000000;">*</span> percentResize<span style="color: #000000;">&#41;</span> <span style="color: #008000; font-style: italic;">'image width. </span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> height <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #6a5acd;">Integer</span> <span style="color: #000000;">=</span> bm<span style="color: #000000;">.</span><span style="color: #000000;">Height</span> <span style="color: #000000;">-</span> <span style="color: #000000;">&#40;</span>bm<span style="color: #000000;">.</span><span style="color: #000000;">Height</span> <span style="color: #000000;">*</span> percentResize<span style="color: #000000;">&#41;</span>  <span style="color: #008000; font-style: italic;">'image height</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> thumb <span style="color: #0000FF; font-weight: bold;">As</span> <span style="color: #0000FF; font-weight: bold;">New</span> Bitmap<span style="color: #000000;">&#40;</span>width, height<span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #0000FF; font-weight: bold;">Dim</span> g <span style="color: #0000FF; font-weight: bold;">As</span> Graphics <span style="color: #000000;">=</span> Graphics<span style="color: #000000;">.</span><span style="color: #000000;">FromImage</span><span style="color: #000000;">&#40;</span>thumb<span style="color: #000000;">&#41;</span>
&nbsp;
        g<span style="color: #000000;">.</span><span style="color: #000000;">InterpolationMode</span> <span style="color: #000000;">=</span> Drawing2D<span style="color: #000000;">.</span><span style="color: #000000;">InterpolationMode</span><span style="color: #000000;">.</span><span style="color: #000000;">HighQualityBicubic</span>
&nbsp;
        g<span style="color: #000000;">.</span><span style="color: #000000;">DrawImage</span><span style="color: #000000;">&#40;</span>bm, <span style="color: #0000FF; font-weight: bold;">New</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">0</span>, <span style="color: #a52a2a; back-color: #fffacd;">0</span>, width, height<span style="color: #000000;">&#41;</span>, <span style="color: #0000FF; font-weight: bold;">New</span> Rectangle<span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">0</span>, <span style="color: #a52a2a; back-color: #fffacd;">0</span>, bm<span style="color: #000000;">.</span><span style="color: #000000;">Width</span>, _
bm<span style="color: #000000;">.</span><span style="color: #000000;">Height</span><span style="color: #000000;">&#41;</span>, GraphicsUnit<span style="color: #000000;">.</span><span style="color: #000000;">Pixel</span><span style="color: #000000;">&#41;</span>
&nbsp;
        g<span style="color: #000000;">.</span><span style="color: #000000;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        bm<span style="color: #000000;">.</span><span style="color: #000000;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
        <span style="color: #008000; font-style: italic;">'image path.</span>
        thumb<span style="color: #000000;">.</span><span style="color: #000000;">Save</span><span style="color: #000000;">&#40;</span><span style="color: #a52a2a; back-color: #fffacd;">&quot;C:\&quot;</span> <span style="color: #000000;">&amp;</span> dir <span style="color: #000000;">&amp;</span> <span style="color: #a52a2a; back-color: #fffacd;">&quot;\&quot;</span> <span style="color: #000000;">&amp;</span> fileName, _
System<span style="color: #000000;">.</span><span style="color: #000000;">Drawing</span><span style="color: #000000;">.</span><span style="color: #000000;">Imaging</span><span style="color: #000000;">.</span><span style="color: #000000;">ImageFormat</span><span style="color: #000000;">.</span><span style="color: #000000;">Jpeg</span><span style="color: #000000;">&#41;</span> <span style="color: #008000; font-style: italic;">'can use any image format </span>
&nbsp;
        thumb<span style="color: #000000;">.</span><span style="color: #000000;">Dispose</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
&nbsp;
    <span style="color: #0000FF; font-weight: bold;">End</span> <span style="color: #0000FF; font-weight: bold;">Sub</span></pre></td></tr></table></div>

<p>To use the code all you have to do is to pass in the directory of the image , the file name and the percentage of increase / decrease that you would like. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.thedesilva.com/2010/01/resize-image-using-vb-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
