<?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>DevtheWeb.NET &#187; VB.NET</title>
	<atom:link href="http://www.devtheweb.net/blog/tag/vb-net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.devtheweb.net/blog</link>
	<description></description>
	<lastBuildDate>Tue, 06 Dec 2011 19:25:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Create a VB.NET app that can be run in only one instance</title>
		<link>http://www.devtheweb.net/blog/2010/03/11/create-a-vb-net-app-that-can-be-run-in-only-one-instance/</link>
		<comments>http://www.devtheweb.net/blog/2010/03/11/create-a-vb-net-app-that-can-be-run-in-only-one-instance/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 10:37:23 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[VB.NET]]></category>

		<guid isPermaLink="false">http://www.devtheweb.net/blog/?p=1193</guid>
		<description><![CDATA[For some application you make want the user to be able to run only one of their instances (ex. an e-mail client). I found an easy way how it can be done. If you are developing an VB.NET Windows Form application, first you will need to get the name of your main module and then [...]]]></description>
			<content:encoded><![CDATA[<p>For some application you make want the user to be able to run only one of their instances (ex. an e-mail client). I found an easy way how it can be done.
<div style="float:left; margin-right:5px;"><!--adsense--></div>
<p>If you are developing an VB.NET Windows Form application, first you will need to get the name of your main module and then to look for it in the collection of currently running processes. Here&#8217;s a simple example how it can be done:</p>
<p>Imports System.Diagnostics</p>
<p>&#8230;</p>
<p>Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load</p>
<p>Dim moduleName As String = Diagnostics.Process.GetCurrentProcess.MainModule.ModuleName</p>
<p>Dim procName As String = System.IO.Path.GetFileNameWithoutExtension(moduleName)</p>
<p>If Process.GetProcessesByName(procName).Length &gt; 1 Then</p>
<p>MessageBox.Show(&#8220;Already running&#8221;)</p>
<p>Application.Exit()</p>
<p>End If</p>
<p>End Sub</p>
<p>Well, that&#8217;s all <img src='http://www.devtheweb.net/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.devtheweb.net/blog/2010/03/11/create-a-vb-net-app-that-can-be-run-in-only-one-instance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

