<?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, 13 Sep 2011 21:46:32 +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>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 [...]]]></description>
			<content:encoded><![CDATA[<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>
<pre class="brush: vb; title: ; notranslate">
Private Sub forma_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs)
Dim valor1 As [Decimal]
Dim valor2 As [Decimal]
valor1 = Convert.ToDecimal(txtval1.Text)
valor2 = Convert.ToDecimal(txtval2.Text)
If valor1 &lt;&gt; valor2 Then
MessageBox.Show(Me, &quot;Los valore deben coincidir&quot;, &quot;Error&quot;, MessageBoxButtons.OK, MessageBoxIcon.[Error])
e.Cancel = True 'evita que el form se cierre

End If
End Sub
</pre>
<pre class="brush: csharp; title: ; notranslate">
private void forma_FormClosing(object sender, FormClosingEventArgs e)
{
Decimal valor1;
Decimal valor2;
valor1 = Convert.ToDecimal(valor1.Text);
valor2 = Convert.ToDecimal(valor2.Text);
if (valor1 != valor2)
{
MessageBox.Show(this, &quot;Los valores deben coincidir&quot;, &quot;Error&quot;,MessageBoxButtons.OK,MessageBoxIcon.Error);
e.Cancel = true; //evita que el form se cierre
}

}
</pre>
<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>

