<?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>GeoAvila (Geovanny G. Avila) &#187; FormClosing</title>
	<atom:link href="http://geoavila.com/tag/formclosing/feed/" rel="self" type="application/rss+xml" />
	<link>http://geoavila.com</link>
	<description>Desarrollo.. de software.</description>
	<lastBuildDate>Tue, 27 Apr 2010 23:30:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Impedir que un form se cierre csharp,vb.net</title>
		<link>http://geoavila.com/impedir-que-un-form-se-cierre-csharpvb-net/</link>
		<comments>http://geoavila.com/impedir-que-un-form-se-cierre-csharpvb-net/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 22:42:32 +0000</pubDate>
		<dc:creator>GeoAvila</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Visual Basic .NET]]></category>
		<category><![CDATA[Form Closing]]></category>
		<category><![CDATA[FormClosing]]></category>
		<category><![CDATA[Impedir cierre form .net]]></category>
		<category><![CDATA[Impedir que form se cierre .net]]></category>

		<guid isPermaLink="false">http://geoavila.com/?p=202</guid>
		<description><![CDATA[


 A continuación, este código te ayudará para evitar que un formularion se cierre sin previa validación, para esto usamos la evento FormClosing de los formulacion de Windows Forms.
En Visual Basic .Net es de esta manera
PLAIN TEXT
VB.NET:




Private Sub forma_FormClosing&#40;ByVal sender As Object, ByVal e As FormClosingEventArgs&#41;


Dim valor1 As &#91;Decimal&#93;


Dim valor2 As &#91;Decimal&#93;


valor1 = Convert.ToDecimal&#40;txtval1.Text&#41;


valor2 = [...]]]></description>
			<content:encoded><![CDATA[<p><script type="text/javascript"><!--
google_ad_client = "pub-6058344163325637";
/* 468x15, creado 17/10/08 */
google_ad_slot = "2693427472";
google_ad_width = 468;
google_ad_height = 15;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></-> <p>A continuación, este código te ayudará para evitar que un formularion se cierre sin previa validación, para esto usamos la evento FormClosing de los formulacion de Windows Forms.</p>
<p>En Visual Basic .Net es de esta manera</p>
<div class="igBar"><span id="lvbnet-3"><a href="#" onclick="javascript:showPlainTxt('vbnet-3'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">VB.NET:</span>
<div id="vbnet-3">
<div class="vbnet">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> forma_FormClosing<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Object</span>, <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> FormClosingEventArgs<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> valor1 <span style="color: #FF8000;">As</span> <span style="color: #000000;">&#91;</span>Decimal<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">Dim</span> valor2 <span style="color: #FF8000;">As</span> <span style="color: #000000;">&#91;</span>Decimal<span style="color: #000000;">&#93;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">valor1 = Convert.<span style="color: #0000FF;">ToDecimal</span><span style="color: #000000;">&#40;</span>txtval1.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">valor2 = Convert.<span style="color: #0000FF;">ToDecimal</span><span style="color: #000000;">&#40;</span>txtval2.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">If</span> valor1 &lt;&gt; valor2 <span style="color: #FF8000;">Then</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>, <span style="color: #808080;">"Los valore deben coincidir"</span>, <span style="color: #808080;">"Error"</span>, MessageBoxButtons.<span style="color: #0600FF;">OK</span>, MessageBoxIcon.<span style="color: #000000;">&#91;</span><span style="color: #FF8000;">Error</span><span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">e.<span style="color: #0600FF;">Cancel</span> = <span style="color: #0600FF;">True</span> <span style="color: #008080; font-style: italic;">'evita que el form se cierre</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<div class="igBar"><span id="lcsharp-4"><a href="#" onclick="javascript:showPlainTxt('csharp-4'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">C#:</span>
<div id="csharp-4">
<div class="csharp">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">private</span> <span style="color: #0600FF;">void</span> forma_FormClosing<span style="color: #000000;">&#40;</span><span style="color: #FF0000;">object</span> sender, FormClosingEventArgs e<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">Decimal</span> valor1;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #FF0000;">Decimal</span> valor2;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">valor1 = Convert.<span style="color: #0000FF;">ToDecimal</span><span style="color: #000000;">&#40;</span>valor1.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">valor2 = Convert.<span style="color: #0000FF;">ToDecimal</span><span style="color: #000000;">&#40;</span>valor2.<span style="color: #0000FF;">Text</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #0600FF;">if</span> <span style="color: #000000;">&#40;</span>valor1 != valor2<span style="color: #000000;">&#41;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">MessageBox.<span style="color: #0000FF;">Show</span><span style="color: #000000;">&#40;</span><span style="color: #0600FF;">this</span>, <span style="color: #808080;">"Los valores deben coincidir"</span>, <span style="color: #808080;">"Error"</span>,MessageBoxButtons.<span style="color: #0000FF;">OK</span>,MessageBoxIcon.<span style="color: #0000FF;">Error</span><span style="color: #000000;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">e.<span style="color: #0000FF;">Cancel</span> = <span style="color: #0600FF;">true</span>; <span style="color: #008080; font-style: italic;">//evita que el form se cierre</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #000000;">&#125;</span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Un código bastante útil en el tema de validaciones y prohibiciones para que esas ocaciones que se necesita aplicar seguridad en los formularios.</p>
<p>Nos vemos.</p>
]]></content:encoded>
			<wfw:commentRss>http://geoavila.com/impedir-que-un-form-se-cierre-csharpvb-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
