<?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>El Blog de Albert Mata &#187; .NET</title>
	<atom:link href="http://www.albertmata.net/category/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.albertmata.net</link>
	<description>// anotaciones de análisis y programación en mi día a día como consultor de software</description>
	<lastBuildDate>Mon, 03 Aug 2009 19:22:21 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Rapidez de operaciones entre Integer, Long y Double.</title>
		<link>http://www.albertmata.net/2009/02/rapidez-de-operaciones-entre-integer-long-y-double/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=rapidez-de-operaciones-entre-integer-long-y-double</link>
		<comments>http://www.albertmata.net/2009/02/rapidez-de-operaciones-entre-integer-long-y-double/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 16:27:28 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[int16]]></category>
		<category><![CDATA[int32]]></category>
		<category><![CDATA[int64]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=227</guid>
		<description><![CDATA[Como quiera que estos últimos días ando trabajando algunos aspectos que hacen relación a los distintos tipos de datos, sobretodo en lo que a la clase Nullable se refiere, me he topado con una referencia a la velocidad de cálculo de operaciones en función del tipo de dato. Y como me ha parecido curiosa, he [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/11/visualstudio.jpg" alt="" title="visualstudio" width="299" height="94" class="alignleft size-full wp-image-144" />Como quiera que estos últimos días ando trabajando algunos aspectos que hacen relación a los distintos tipos de datos, sobretodo en lo que a la clase Nullable se refiere, me he topado con una referencia a la velocidad de cálculo de operaciones en función del tipo de dato. Y como me ha parecido curiosa, he buscado la manera de poder comparar de manera fácil y rápida la velocidad entre distintos tipos de datos para ver qué valores me daba.</p>
<p>Los tipos de datos a comparar son Integer (Int32), Long (Int64) y Double.</p>
<p>El código que utilizo para comparar tiempos es el siguiente (la variable v cambia entre Integer, Long y Double en cada ejecución):</p>
<div class="code">Dim&#160;v&#160;As&#160;Integer&#160;&#61;&#160;0<br />
Dim&#160;Begin&#160;As&#160;Date&#160;&#61;&#160;Now&#40;&#41;</p>
<p>For&#160;i&#160;As&#160;Integer&#160;&#61;&#160;1&#160;To&#160;1000000000<br />
&#160;&#160;&#160;&#160;v&#160;&#43;&#61;&#160;1<br />
Next</p>
<p>Dim&#160;Finish&#160;As&#160;Date&#160;&#61;&#160;Now&#40;&#41;<br />
Debug&#46;Print&#40;Finish&#46;Subtract&#40;Begin&#41;&#46;TotalMilliseconds&#46;ToString&#41;</p></div>
<p>Básicamente no hace más que incrementar el valor de una variable mil millones de veces (¿quién no ha necesitado algo así alguna vez, eh?).</p>
<p>Para un Integer obtengo estos tiempos en tres ejecuciones consecutivas:<br />
3884 - 3890 - 3876</p>
<p>Para un Long obtengo estos otros:<br />
4437 - 4453 - 4444</p>
<p>Y para un Double estos de aquí:<br />
4980 - 4990 - 4990</p>
<p>Pues sí. Realmente un Integer es algo más rápido que los demás en cuanto a velocidad de cálculo (en realidad alrededor de un 20% sobre los resultados de Double, aunque con unas cifras tan insignificantes el resultado nace de por sí algo desvirtuado).</p>
<p>Por último una recomendación personal, puestos a escoger y como cuesta lo mismo una cosa que otra, mejor trabajar con Int16, Int32 o Int64 que con Short, Integer o Long. Son exactamente lo mismo pero la primera sintaxis es exclusiva de Visual Basic, mientras que la segunda hace referencia al .NET Framework y por tanto es común a todos los lenguajes que lo utilizan (incluído el propio Visual Basic).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2009/02/rapidez-de-operaciones-entre-integer-long-y-double/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>SummaryDataGridView o cómo mostrar fila de totales en un DataGridView en VisualBasic.NET.</title>
		<link>http://www.albertmata.net/2009/02/summarydatagridview-o-como-mostrar-fila-de-totales-en-un-datagridview-en-visualbasicnet/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=summarydatagridview-o-como-mostrar-fila-de-totales-en-un-datagridview-en-visualbasicnet</link>
		<comments>http://www.albertmata.net/2009/02/summarydatagridview-o-como-mostrar-fila-de-totales-en-un-datagridview-en-visualbasicnet/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 12:01:10 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[datagridview]]></category>
		<category><![CDATA[datarow]]></category>
		<category><![CDATA[datatable]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[summary]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=216</guid>
		<description><![CDATA[Ayer estaba intentando mostrar una fila de totales en un objeto DataGridView y tras unas horitas de buscar, investigar, probar, depurar y desesperar... descubrí que en realidad no se puede hacer tal cosa de manera directa. Si el DataGridView está enlazado a datos (caso más habitual), no nos permitirá añadir una fila directamente. Sí que [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/11/visualstudio.jpg" alt="" title="visualstudio" width="299" height="94" class="alignleft size-full wp-image-144" />Ayer estaba intentando mostrar una fila de totales en un objeto DataGridView y tras unas horitas de buscar, investigar, probar, depurar y desesperar... descubrí que en realidad no se puede hacer tal cosa de manera directa. Si el DataGridView está enlazado a datos (caso más habitual), no nos permitirá añadir una fila directamente. Sí que se la podremos añadir al propio origen de datos (supongamos que un DataTable), pero aun así tendremos muchos problemas cuando el usuario ordene los resultados del DataGridView por alguna de las columnas simplemente haciendo click sobre su encabezado. Por supuesto podemos eliminar la posibilidad de que se pueda hacer click en los encabezados de las columnas para ordenar los resultados, pero eso no es más que eliminar un problema quitando una funcionalidad importante, así que no se acepta dicha solución.</p>
<p>Al final he optado por crearme mi propio SummaryDataGridView que hereda directamente de la clase DataGridView, con lo cual tiene intactos todos sus métodos, eventos y propiedades y por tanto se puede utilizar en cualquier punto donde quisiéramos utilizar un DataGridView. Pero además incorpora los métodos siguientes:</p>
<div class="subtitle">Public Sub SetDataSource(ByVal dt As DataTable)</div>
<p>Debe utilizarse cuando queramos establecer el origen de datos del SummaryDataGridView. Se podría utilizar simplemente la propiedad DataSource, pero en ese caso no funcionarían las características extras del SummaryDataGridView, por lo cual conviene utilizar este método SetDataSource en lugar de la propiedad DataSource. Probablemente se podría haver sobrecargado la propiedad DataSource del DataGridView, pero he preferido dejarla intacta y utilizar un nuevo método público propio.</p>
<div class="subtitle">Public Sub AddSummaryRow(ByVal ParamArray ColumnName() As String)</div>
<p>Añade una última fila al SummaryDataGridView con los totales (sumas) de todas las columnas cuyos nombres se hayan indicado como parámetros.</p>
<div class="subtitle">Public Sub SetFilter(ByVal Filter As String)</div>
<p>Permite filtrar los resultados a mostrar en el SummaryDataGridView mediante una condición tipo SQL simple o compuesta. Evidentemente, tras filtrar los resultados mostrados la fila de totales se actualiza convenientemente.</p>
<p>Así pues, una vez tenemos un objeto SummaryDataGridView en nuestro formulario, podemos poblarlo, añadirle una fila de totales y filtrarlo del siguiente modo:</p>
<div class="code">Me.dgvMain.SetDataSource(dt)</div>
<div class="code">Me.dgvMain.AddSummaryRow("field1", "field2", "fieldN")</div>
<div class="code">Me.dgvMain.SetFilter("field1 < 10 AND field2 > 5")</div>
<p>A continuación dejo el código fuente íntegro de esta clase SummaryDataGridView. Y ya sabes... si te ha sido útil tienes la obligación moral de... a) enviarme una transferencia por valor de 500 euros para compensarme por las horas de desarrollo... o bien b) dejar un comentario excusándote por no hacerme la transferencia y contándome qué tal te funcionó el SummaryDataGridView.</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Last&#160;time&#160;modified&#58;&#160;2009&#45;02&#45;17<br />
&#39;&#160;Description&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Acts&#160;like&#160;a&#160;standard&#160;DataGridView&#160;but&#160;with&#160;the<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;possibility&#160;to&#160;add&#160;a&#160;summary&#160;row&#160;fixed&#160;at&#160;the&#160;<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;end&#160;even&#160;when&#160;user&#160;sorts&#160;data&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Public&#160;Class&#160;SummaryDataGridView<br />
&#160;&#160;&#160;&#160;Inherits&#160;System&#46;Windows&#46;Forms&#46;DataGridView</p>
<p>&#35;Region&#160;&#34;PrivateAttributes&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Private&#160;attributes&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;After&#160;it&#39;s&#160;been&#160;set&#44;&#160;it&#160;will&#160;not&#160;change&#160;anymore&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;MainDataTable&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#39;It&#160;can&#160;be&#160;Nothing&#160;and&#160;it&#160;changes&#160;every&#160;time&#160;filter&#160;does&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;SummaryDataRow&#160;As&#160;DataRow<br />
&#160;&#160;&#160;&#160;&#39;It&#160;always&#160;has&#160;same&#160;data&#160;shown&#160;in&#160;DataGridView&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;ShownDataTable&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#39;It&#39;s&#160;Nothing&#160;or&#160;it&#160;stores&#160;a&#160;column&#160;name&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;LastSortedColumn&#160;As&#160;String<br />
&#160;&#160;&#160;&#160;&#39;It&#39;s&#160;Nothing&#160;or&#160;it&#160;stores&#160;ASC&#47;DESC&#160;string&#160;value&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;LastSortOrder&#160;As&#160;String<br />
&#160;&#160;&#160;&#160;&#39;Array&#160;of&#160;column&#160;names&#160;to&#160;summarize&#46;<br />
&#160;&#160;&#160;&#160;Private&#160;SummaryColumns&#40;&#41;&#160;As&#160;String</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;PublicMethods&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Sets&#160;DataSource&#160;and&#160;stores&#160;initial&#160;DataTable&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;SetDataSource&#40;ByVal&#160;dt&#160;As&#160;DataTable&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;MainDataTable&#160;and&#160;adding&#160;auxiliar&#160;column<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;for&#160;SummaryRow&#160;information&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;MainDataTable&#160;&#61;&#160;dt<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;MainDataTable&#46;Columns&#46;Add&#40;New&#160;DataColumn&#40;&#34;&#64;SummaryRow&#34;&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;System&#46;Type&#46;GetType&#40;&#34;System&#46;Byte&#34;&#41;&#41;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;new&#160;auxiliar&#160;column&#160;value&#160;to&#160;0&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#40;in&#160;SummaryRow&#160;it&#39;ll&#160;be&#160;1&#41;&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;Each&#160;dr&#160;As&#160;DataRow&#160;In&#160;Me&#46;MainDataTable&#46;Rows<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dr&#46;Item&#40;&#34;&#64;SummaryRow&#34;&#41;&#160;&#61;&#160;0<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Filling&#160;DataGridView&#160;with&#160;ShownDataTable&#160;and&#160;hidding&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;auxiliar&#160;column&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;ShownDataTable&#160;&#61;&#160;Me&#46;MainDataTable&#46;Copy&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;DataSource&#160;&#61;&#160;Me&#46;ShownDataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;Columns&#40;&#34;&#64;SummaryRow&#34;&#41;&#46;Visible&#160;&#61;&#160;False</p>
<p>&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Adds&#160;a&#160;summary&#160;row&#160;to&#160;DataGridView&#160;with&#160;values&#160;in&#160;all<br />
&#160;&#160;&#160;&#160;&#39;&#160;specified&#160;columns&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;AddSummaryRow&#40;ByVal&#160;ParamArray&#160;ColumnName&#40;&#41;&#160;As&#160;String&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Removing&#160;SummaryRow&#160;from&#160;ShownDataTable&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;if&#160;it&#160;already&#160;contains&#160;it&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Me&#46;ShownDataTable&#46;Rows&#46;IndexOf&#40;Me&#46;SummaryDataRow&#41;&#160;&#62;&#160;&#45;1&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;ShownDataTable&#46;Rows&#46;Remove&#40;Me&#46;SummaryDataRow&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Storing&#160;columns&#160;to&#160;be&#160;summarized&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#40;can&#160;be&#160;useful&#160;for&#160;other&#160;methods&#41;&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;SummaryColumns&#160;&#61;&#160;ColumnName</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;SummaryDataRow&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;SummaryDataRow&#160;&#61;&#160;Me&#46;ShownDataTable&#46;NewRow&#40;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Adding&#160;SUM&#160;values&#160;to&#160;each&#160;specified&#160;column&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;i&#160;As&#160;Integer&#160;&#61;&#160;0&#160;To&#160;ColumnName&#46;Length&#160;&#45;&#160;1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;SummaryDataRow&#46;Item&#40;ColumnName&#40;i&#41;&#41;&#160;&#61;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;ShownDataTable&#46;Compute&#40;&#34;SUM&#40;&#34;&#160;&#38;&#160;ColumnName&#40;i&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#34;&#41;&#34;&#44;&#160;&#34;&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;auxiliar&#160;column&#160;value&#160;to&#160;1&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#40;useful&#160;for&#160;sorting&#160;purposes&#41;&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;SummaryDataRow&#46;Item&#40;&#34;&#64;SummaryRow&#34;&#41;&#160;&#61;&#160;1</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Adding&#160;TotalsDataRow&#160;to&#160;ShownDataTable&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;ShownDataTable&#46;Rows&#46;Add&#40;Me&#46;SummaryDataRow&#41;</p>
<p>&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Sets&#160;a&#160;filter&#160;to&#160;DataGridView&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;SetFilter&#40;ByVal&#160;Filter&#160;As&#160;String&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;DataView&#160;with&#160;desired&#160;filter&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;dv&#160;As&#160;New&#160;DataView&#40;Me&#46;MainDataTable&#44;&#160;Filter&#44;&#160;&#34;&#34;&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DataViewRowState&#46;CurrentRows&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;ShownDataTable&#160;&#61;&#160;dv&#46;ToTable&#40;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Adding&#160;new&#160;calculated&#160;SummaryRow&#160;if&#160;it&#160;already&#160;exists&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;IsNothing&#40;Me&#46;SummaryDataRow&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;AddSummaryRow&#40;Me&#46;SummaryColumns&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;sorting&#160;SQL&#160;clausule&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;OrderBy&#160;As&#160;String&#160;&#61;&#160;&#34;&#34;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;IsNothing&#40;Me&#46;LastSortedColumn&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;Not&#160;IsNothing&#40;Me&#46;LastSortOrder&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OrderBy&#160;&#61;&#160;&#34;&#64;SummaryRow&#160;ASC&#44;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;Me&#46;LastSortedColumn&#160;&#38;&#160;&#34;&#160;&#34;&#160;&#38;&#160;Me&#46;LastSortOrder<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Sorting&#160;DataView&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;dv&#160;&#61;&#160;New&#160;DataView&#40;Me&#46;ShownDataTable&#44;&#160;&#34;&#34;&#44;&#160;OrderBy&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DataViewRowState&#46;CurrentRows&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Filling&#160;DataGridView&#160;with&#160;DataView&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;DataSource&#160;&#61;&#160;dv</p>
<p>&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;EventHandlers&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Event&#160;Me&#46;Sorted&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;ExtendedDataGridView&#95;Sorted&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;Sorted</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;sorted&#160;column&#160;and&#160;sort&#160;order&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Me&#46;SortedColumn&#46;Name&#160;&#61;&#160;Me&#46;LastSortedColumn&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Me&#46;LastSortOrder&#160;&#61;&#160;&#34;ASC&#34;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;LastSortOrder&#160;&#61;&#160;&#34;DESC&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;LastSortOrder&#160;&#61;&#160;&#34;ASC&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;LastSortedColumn&#160;&#61;&#160;Me&#46;SortedColumn&#46;Name<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;LastSortOrder&#160;&#61;&#160;&#34;ASC&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;sorting&#160;SQL&#160;clausule&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;OrderBy&#160;As&#160;String&#160;&#61;&#160;&#34;&#64;SummaryRow&#160;ASC&#44;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;Me&#46;LastSortedColumn&#160;&#38;&#160;&#34;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;Me&#46;LastSortOrder</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;DataView&#160;with&#160;desired&#160;sort&#160;order&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;dv&#160;As&#160;New&#160;DataView&#40;Me&#46;ShownDataTable&#44;&#160;&#34;&#34;&#44;&#160;OrderBy&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DataViewRowState&#46;CurrentRows&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Filling&#160;DataGridView&#160;with&#160;DataView&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;DataSource&#160;&#61;&#160;dv</p>
<p>&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#35;End&#160;Region</p>
<p>End&#160;Class</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2009/02/summarydatagridview-o-como-mostrar-fila-de-totales-en-un-datagridview-en-visualbasicnet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Me.DesignMode o ¿podrías por favor no interpretar el código mientras sólo estoy diseñando? (Gracias)</title>
		<link>http://www.albertmata.net/2009/01/medesignmode-o-%c2%bfpodrias-por-favor-no-interpretar-el-codigo-mientras-solo-estoy-disenando-gracias/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=medesignmode-o-%25c2%25bfpodrias-por-favor-no-interpretar-el-codigo-mientras-solo-estoy-disenando-gracias</link>
		<comments>http://www.albertmata.net/2009/01/medesignmode-o-%c2%bfpodrias-por-favor-no-interpretar-el-codigo-mientras-solo-estoy-disenando-gracias/#comments</comments>
		<pubDate>Sat, 31 Jan 2009 09:15:00 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[designmode]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=207</guid>
		<description><![CDATA[VisualBasic.NET (supongo que todo el VisualStudio.NET) tiene un comportamiento que me desquicia. Bueno, tiene unos cuantos, pero hoy hablo de uno en particular. Imaginemos un caso muy habitual en el que tengo un control de usuario y un formulario. Primero diseño el control de usuario y luego en el formulario lo insertaré.
El control de usuario [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2009/01/designmode.png" alt="" title="designmode" width="277" height="111" class="alignleft size-full wp-image-208" />VisualBasic.NET (supongo que todo el VisualStudio.NET) tiene un comportamiento que me desquicia. Bueno, tiene unos cuantos, pero hoy hablo de uno en particular. Imaginemos un caso muy habitual en el que tengo un control de usuario y un formulario. Primero diseño el control de usuario y luego en el formulario lo insertaré.</p>
<p>El control de usuario (ctrlDGV.vb) lo creo simplemente añadiéndole un objeto de tipo DataGridView (dgvMain) y el siguiente código:</p>
<div class="code">Public&#160;Class&#160;ctrlDGV</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Private&#160;attribute&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;DBC&#160;As&#160;DatabaseConnection</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Setter&#160;for&#160;DBC&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;LoadDBC&#40;ByVal&#160;DBC&#160;As&#160;DatabaseConnection&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;DBC&#160;&#61;&#160;DBC<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Event&#160;Me&#46;Load&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;ctrlDGV&#95;Load&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;Load<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#160;&#61;&#160;Me&#46;DBC&#46;GetDataTable&#40;&#34;SELECT&#160;field&#160;FROM&#160;table&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;dgvMain&#46;DataSource&#160;&#61;&#160;DT<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>End&#160;Class</p></div>
<p>El objeto Me.DBC es un objeto de conexión a datos cuyo método GetDataTable me devolverá un DataTable a partir de una cadena SQL (es todo lo que necesitamos saber aceca de él en lo que a este post se refiere). La manera de crear ese objeto Me.DBC no atañe a este control, porque asumimos que siempre nos preocuparemos de llamar al método LoadDBC (y por tanto asegurarnos que Me.DBC ha dejado de ser Nothing) antes de que se dispare el evento Me.Load, así que no habrá problemas.</p>
<p>¿No habrá problemas? Sí, sí que los habrá... Los habrá simplemente cuando intentemos insertar este control en un formulario en vista diseño. En ese momento obtendremos el siguiente error...</p>
<p><img src="http://www.albertmata.net/public/uploads/2009/01/errordesignmode.png" alt="" title="errordesignmode" width="435" height="445" class="alignnone size-full wp-image-209" /></p>
<p>...y no nos dejará insertarlo. ¿Por qué? Pues porque el código en el evento Me.Load se está interpretando y descubre que Me.DBC es todavía Nothing... No entiendo por qué narices tiene que interpretar código en tiempo de diseño, la verdad. Y lo curioso del caso es que si comentamos el código del evento Me.Load entonces nos deja insertar dicho control en un formulario sin problemas. Y si después volvemos a descomentar el código, aunque no podremos ver el formulario en modo diseño porque nos volverá a dar el error, sí que podremos ejecutar la aplicación y funcionará correctamente (si llamamos al método LoadDBC antes de que se lance el evento Me.Load, insisto). Y es normal que funcione porque el flujo es correcto en tiempo de ejecución...</p>
<p>El caso es que para solucionar este problema tenemos dos posibilidades. La primera es actuar a lo bestia y meterlo todo dentro de un Try-Catch y muerto el perro se acabó la rabia:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Event&#160;Me&#46;Load&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Private&#160;Sub&#160;ctrlDGV&#95;Load&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;Load<br />
&#160;&#160;&#160;&#160;Try<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#160;&#61;&#160;Me&#46;DBC&#46;GetDataTable&#40;&#34;SELECT&#160;field&#160;FROM&#160;table&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;dgvMain&#46;DataSource&#160;&#61;&#160;DT<br />
&#160;&#160;&#160;&#160;Catch&#160;ex&#160;As&#160;Exception<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;On&#160;error&#160;no&#160;nothing&#44;&#160;it&#39;s&#160;just&#160;for&#160;design&#160;time&#46;<br />
&#160;&#160;&#160;&#160;End&#160;Try<br />
End&#160;Sub</div>
<p>El segundo es ser un poco más sutil y hacer uso de la propiedad DesignMode del propio control para decirle algo así:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Event&#160;Me&#46;Load&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Private&#160;Sub&#160;ctrlDGV&#95;Load&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;Load<br />
&#160;&#160;&#160;&#160;If&#160;Not&#160;Me&#46;DesignMode&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#160;&#61;&#160;Me&#46;DBC&#46;GetDataTable&#40;&#34;SELECT&#160;field&#160;FROM&#160;table&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;dgvMain&#46;DataSource&#160;&#61;&#160;DT<br />
&#160;&#160;&#160;&#160;End&#160;If<br />
End&#160;Sub</div>
<p>Es decir, si no estás en modo diseño ejecútame este código (si estás en modo diseño no hagas nada). Me parece algo surrealista, sinceramente. Para mí lo normal sería... si estás en modo diseño, no hagas nada, ni te mires el código, ni olerlo, dejámelo a mí... Y como mucho que la propiedad Me.DesignMode sirviera para lo contrario: para explícitamente solicitarle que hiciera una determinada cosa incluso en tiempo de diseño.</p>
<p>Pues hasta que descubrí esto... ufffff...</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2009/01/medesignmode-o-%c2%bfpodrias-por-favor-no-interpretar-el-codigo-mientras-solo-estoy-disenando-gracias/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Quitar la selección de un ComboBox en un DataGridView en .NET.</title>
		<link>http://www.albertmata.net/2009/01/quitar-la-seleccion-de-un-combobox-en-un-datagridview-en-net/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=quitar-la-seleccion-de-un-combobox-en-un-datagridview-en-net</link>
		<comments>http://www.albertmata.net/2009/01/quitar-la-seleccion-de-un-combobox-en-un-datagridview-en-net/#comments</comments>
		<pubDate>Thu, 22 Jan 2009 11:08:21 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[combobox]]></category>
		<category><![CDATA[datagridview]]></category>
		<category><![CDATA[datagridviewcomboboxcolumn]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=205</guid>
		<description><![CDATA[Minipost recordatorio para mí mismo... Hace un rato he descubierto con gran sorpresa y desencanto que si en un objeto de tipo DataGridView tengo puestas algunas columnas como tipo ComboBox a través del objeto propio del .NET Framework DataGridViewComboBoxColumn (toma nombre cortito), y el campo en cuestión es de algún tipo que admite nulos -por [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2009/01/datagridviewcomboboxcolumn.png" alt="" title="datagridviewcomboboxcolumn" width="264" height="187" class="alignleft size-full wp-image-206" />Minipost recordatorio para mí mismo... Hace un rato he descubierto con gran sorpresa y desencanto que si en un objeto de tipo DataGridView tengo puestas algunas columnas como tipo ComboBox a través del objeto propio del .NET Framework DataGridViewComboBoxColumn (toma nombre cortito), y el campo en cuestión es de algún tipo que admite nulos -por ejemplo un Nullable(Of UInt16) o un simple String-... hasta que en el ComboBox no seleccionamos ningún valor, en la tabla relacionada de la base de datos se almacenará un valor NULL sin problemas, pero en el momento en que en el ComboBox seleccionamos un valor, no tenemos manera fácil de quitar esa selección. Dicho en plan fácil, un ComboBox dentro de un DataGridView nos permite seleccionar fácilmente un valor pero difícilmente quitar esa selección (aunque parezca mentira).</p>
<p>No obstante, si el campo es de tipo String no hay demasiado problema: nos podemos situar encima y con la combinación CTRL+0 (control cero) quitamos la selección. Ahora bien, el problema viene cuando el campo es numérico -como Nullable (Of UInt16)-. Aquí no podemos hacer un CTRL+0 sin más o nos lanzará un error.</p>
<p>Buscando buscando he encontrado un par de páginas (<a href="http://appdevchronicles.blogspot.com/2008/07/winforms-vs2005-datagridview-combobox.html" target="_blank">ésta</a> y <a href="http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/bb37d44d-4141-4d53-bbf2-51afb2fffb59/" target="_blank">esta otra</a>) que me han ayudado a resolver el problema y de paso a conocer que se trata de un bug reportado a Microsoft (sin que se hayan esmerado gran cosa en corregirlo, dicho sea de paso). En cualquier caso, la solución pasa por incorporar el siguiente código:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Event&#160;DGV&#46;KeyDown&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Private&#160;Sub&#160;DGV&#95;KeyDown&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
ByVal&#160;e&#160;As&#160;System&#46;Windows&#46;Forms&#46;KeyEventArgs&#41;&#160;&#95;<br />
Handles&#160;DGV&#46;KeyDown<br />
&#160;&#160;&#160;&#160;If&#160;TypeOf&#160;Me&#46;DGV&#46;Columns&#40;Me&#46;DGV&#46;CurrentCell&#46;ColumnIndex&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;Is&#160;System&#46;Windows&#46;Forms&#46;DataGridViewComboBoxColumn&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;e&#46;KeyCode&#160;&#61;&#160;Keys&#46;D0&#160;Or&#160;e&#46;KeyCode&#160;&#61;&#160;Keys&#46;NumPad0&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;e&#46;KeyCode&#160;&#61;&#160;Keys&#46;Delete&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;DGV&#46;CurrentCell&#46;Value&#160;&#61;&#160;System&#46;DBNull&#46;Value<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;End&#160;If<br />
End&#160;Sub</div>
<p>De paso he incorporado la misma funcionalidad para la tecla Suprimir, que siempre es bastante más intuitivo para quitar la selección de un ComboBox que la combinación CTRL+0.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2009/01/quitar-la-seleccion-de-un-combobox-en-un-datagridview-en-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>TextBox mejorado en .NET.</title>
		<link>http://www.albertmata.net/2008/12/textbox-mejorado-en-net/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=textbox-mejorado-en-net</link>
		<comments>http://www.albertmata.net/2008/12/textbox-mejorado-en-net/#comments</comments>
		<pubDate>Tue, 23 Dec 2008 05:00:55 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Herramientas]]></category>
		<category><![CDATA[control personalizado]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[double]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[librería]]></category>
		<category><![CDATA[textbox]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=149</guid>
		<description><![CDATA[Cuando desarrollamos en .NET es habitual utilizar controles personalizados que mejoran los preexistentes. Habitualmente podremos hacer uso de librerías públicas que podemos obtener en internet (liberadas o de pago). Otras veces podremos crearnos nosotros mismos nuestras propias librerías de controles. Yo suelo hacer esto último cuando no se trata de algo demasiado complejo, ya que [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused.jpg" alt="" title="textboxfocused" width="245" height="244" class="alignleft size-full wp-image-150" />Cuando desarrollamos en .NET es habitual utilizar controles personalizados que mejoran los preexistentes. Habitualmente podremos hacer uso de librerías públicas que podemos obtener en internet (liberadas o de pago). Otras veces podremos crearnos nosotros mismos nuestras propias librerías de controles. Yo suelo hacer esto último cuando no se trata de algo demasiado complejo, ya que termino antes que buscando componentes de terceros y peleándome después con sus correspondientes licencias. Entre otras cosas porque cualquier tipo de licencia "share alike" no me sirve.</p>
<p>Uno de los controles que me ahorran mucho trabajo en la creación de formularios es este que presento hoy y que en su día llamé TextBoxFocused (en adelante TBF). Se trata de un TextBox que cambia de color al recibir y perder el foco (de ahí su nombre -por cierto, sé que debería ser FocusedTextBox, pero quería mantener lo de TextBox al inicio-) y permite controlar a priori y a posteriori qué se puede introducir en él.</p>
<p>Un formulario con algunos TBF se vería así:</p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused1.jpg" alt="" title="textboxfocused1" width="341" height="337" class="aligncenter size-full wp-image-151" /></p>
<p>Como se puede apreciar, sin tener que añadir código alguno al formulario, el TBF aparecerá sombreado cuando tenga el foco. Además cuando se esté introduciendo un texto se mostrará en rojo, y cuando ya esté validado quedará en verde, tal como se aprecia en las siguientes imágenes:</p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused2.jpg" alt="" title="textboxfocused2" class="aligncenter size-full wp-image-152" /></p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused3.jpg" alt="" title="textboxfocused3" width="344" height="339" class="aligncenter size-full wp-image-153" /></p>
<p>Nada realmente espectacular, pero queda bonito. Sin embargo en donde el TBF se muestra útil es en el control del contenido introducido. Este control se realiza de una doble manera: a priori y mediante una propiedad del control se establece qué tipo de introducciones se admitirán, a posteriori -si se ha seleccionado- se controla que lo que se ha introducido realmente fuera lo que se debía introducir, impidiendo abandonar el TBF en caso contrario.</p>
<p>Para ello, en la ventana de propiedades del control nos aparecen dos nuevas creadas para la ocasión, tal como se muestra a continuación:</p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused4.jpg" alt="" title="textboxfocused4" width="402" height="43" class="aligncenter size-full wp-image-154" /></p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused5.jpg" alt="" title="textboxfocused5" width="405" height="216" class="aligncenter size-full wp-image-155" /></p>
<p><img src="http://www.albertmata.net/public/uploads/2008/12/textboxfocused6.jpg" alt="" title="textboxfocused6" width="403" height="69" class="aligncenter size-full wp-image-156" /></p>
<p>En las propiedades de cosecha propia siempre añado el prefijo "am" para localizarlas todas juntas. En este caso amAllow permite fijar qué introducciones se permitirán (cualquier cosa, nada de nada, sólo enteros positivos, dobles negativos, etc.) y amPostVerification decide si se aplicará verificación posterior o no.</p>
<p>Esto de amPostVerification tiene un sentido claro. Y es que podemos decirle al control que admita números dobles negativos y así sólo permitirá introducir números, el signo negativo y el signo decimal. Pero es evidente que con esos caracteres se pueden crear expresiones que no se correspondan con un número doble negativo (p.ej. -30-3.8..-25). Con este control a posteriori verificamos que efectivamente lo sea.</p>
<p>A nivel de código el control a posteriori se podría haber implementado a base de cástings y control de errores, pero no ha sido la opción que he escogido. Queda al antojo de cada cual modificar el código como le plazca. </p>
<p>Para su implementación en una aplicación, basta con añadir una clase TextBoxFocused.vb, copiar todo el código que se adjunta a continuación, compilar la aplicación y a partir de entonces tendremos el control disponible para añadirlo en cualquier formulario. O también se puede <a href="http://www.albertmata.net/2008/06/crear-libreria-dll-en-net-%C2%A1y-utilizarla/" target="_blank"> añadir a una librería de controles personalizados</a> (que es lo que hago yo) y mantenerlo un poquito más organizado.</p>
<p>Código completo (de libre uso como todo lo que aparece publicado en este blog):</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Last&#160;time&#160;modified&#58;&#160;2008&#45;11&#45;13<br />
&#39;&#160;Description&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Acts&#160;like&#160;a&#160;standard&#160;TextBox&#160;but&#160;with&#160;some&#160;<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;better&#160;features&#160;like&#160;changing&#160;color&#160;when&#160;gets&#160;<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;or&#160;losts&#160;focus&#160;and&#160;controlling&#160;allowed&#160;<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;introductions&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Imports&#160;System&#46;Drawing</p>
<p>Public&#160;Class&#160;TextBoxFocused<br />
&#160;&#160;&#160;&#160;Inherits&#160;System&#46;Windows&#46;Forms&#46;TextBox</p>
<p>&#35;Region&#160;&#34;Constants&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Constants&#160;for&#160;colors&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;COLOR&#95;FOCUSED&#160;As&#160;Color&#160;&#61;&#160;Color&#46;FromArgb&#40;255&#44;&#160;240&#44;&#160;157&#41;<br />
&#160;&#160;&#160;&#160;Private&#160;COLOR&#95;NON&#95;FOCUSED&#160;As&#160;Color&#160;&#61;&#160;Color&#46;White<br />
&#160;&#160;&#160;&#160;Private&#160;COLOR&#95;VALIDATED&#160;As&#160;Color&#160;&#61;&#160;Color&#46;Green<br />
&#160;&#160;&#160;&#160;Private&#160;COLOR&#95;NON&#95;VALIDATED&#160;As&#160;Color&#160;&#61;&#160;Color&#46;Red</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Constants&#160;for&#160;special&#160;keys&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;ASC&#95;BACKSPACE&#160;As&#160;Integer&#160;&#61;&#160;8<br />
&#160;&#160;&#160;&#160;Private&#160;ASC&#95;SUPPRESS&#160;As&#160;Integer&#160;&#61;&#160;127<br />
&#160;&#160;&#160;&#160;Private&#160;ASC&#95;DASH&#160;As&#160;Integer&#160;&#61;&#160;45<br />
&#160;&#160;&#160;&#160;Private&#160;ASC&#95;COMMA&#160;As&#160;Integer&#160;&#61;&#160;44</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;Enumerations&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Enumerations&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Enum&#160;Introduction<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NothingAtAll<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;PositiveInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NegativeInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;PositiveDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NegativeDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OnlyLetter<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OnlyLetterOrDigit<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Password<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Everything<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;EverythingNonCasing<br />
&#160;&#160;&#160;&#160;End&#160;Enum</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;Attributes&#38;Properties&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Attributes&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;aAllow&#160;As&#160;Introduction&#160;&#61;&#160;Introduction&#46;Everything<br />
&#160;&#160;&#160;&#160;Private&#160;aPostVerification&#160;As&#160;Boolean&#160;&#61;&#160;True</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Public&#160;properties&#160;to&#160;be&#160;shown&#160;in&#160;design&#160;time&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Property&#160;amAllow&#40;&#41;&#160;As&#160;Introduction<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Get<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;aAllow<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Get<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Set&#40;ByVal&#160;value&#160;As&#160;Introduction&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;aAllow&#160;&#61;&#160;value<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Set<br />
&#160;&#160;&#160;&#160;End&#160;Property<br />
&#160;&#160;&#160;&#160;Public&#160;Property&#160;amPostVerification&#40;&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Get<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;aPostVerification<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Get<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Set&#40;ByVal&#160;value&#160;As&#160;Boolean&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;aPostVerification&#160;&#61;&#160;value<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Set<br />
&#160;&#160;&#160;&#160;End&#160;Property</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;GraphicalControls&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Event&#160;Me&#46;GotFocus&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;TextBoxFocused&#95;GotFocus&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;GotFocus<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyBase&#46;BackColor&#160;&#61;&#160;COLOR&#95;FOCUSED<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyBase&#46;ForeColor&#160;&#61;&#160;COLOR&#95;NON&#95;VALIDATED<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Event&#160;Me&#46;LostFocus&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;TextBoxFocused&#95;LostFocus&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;Me&#46;LostFocus<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Me&#46;CheckText&#40;&#41;&#160;Or&#160;Not&#160;Me&#46;aPostVerification&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyBase&#46;BackColor&#160;&#61;&#160;COLOR&#95;NON&#95;FOCUSED<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyBase&#46;ForeColor&#160;&#61;&#160;COLOR&#95;VALIDATED<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;Focus&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Event&#160;Me&#46;KeyPress&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;TextBoxFocused&#95;KeyPress&#40;ByVal&#160;sender&#160;As&#160;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;Windows&#46;Forms&#46;KeyPressEventArgs&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;Handles&#160;Me&#46;KeyPress<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Select&#160;Case&#160;Me&#46;aAllow<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NothingAtAll<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;no&#160;character&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#61;&#160;ASC&#95;BACKSPACE&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MyBase&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;PositiveInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;just&#160;digits&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NegativeInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;just&#160;digits&#160;and&#160;&#39;&#45;&#39;&#160;character&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;DASH&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;PositiveDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;just&#160;digits&#160;and&#160;&#39;&#44;&#39;&#160;character&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;COMMA&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NegativeDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;just&#160;digits&#160;and&#160;&#39;&#45;&#39;&#160;and&#160;&#39;&#44;&#39;&#160;characters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;DASH&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;COMMA&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;OnlyLetter<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;only&#160;letters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsLetter&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;KeyChar&#160;&#61;&#160;Char&#46;ToUpper&#40;e&#46;KeyChar&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;OnlyLetterOrDigit<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;only&#160;letters&#160;and&#160;digits&#160;and&#160;upper&#160;casing&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;letters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsLetterOrDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;KeyChar&#160;&#61;&#160;Char&#46;ToUpper&#40;e&#46;KeyChar&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;Password<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;only&#160;letters&#160;and&#160;digits&#160;but&#160;not&#160;upper&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;casing&#160;letters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;Char&#46;IsLetterOrDigit&#40;e&#46;KeyChar&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;BACKSPACE&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;AscW&#40;e&#46;KeyChar&#41;&#160;&#60;&#62;&#160;ASC&#95;SUPPRESS&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;Handled&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;Everything<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;everything&#160;upper&#160;casing&#160;letters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;e&#46;KeyChar&#160;&#61;&#160;Char&#46;ToUpper&#40;e&#46;KeyChar&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;EverythingNonCasing<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;everything&#160;not&#160;upper&#160;casing&#160;letters&#160;&#40;so&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;doing&#160;nothing&#41;&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Select<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#35;End&#160;Region</p>
<p>&#35;Region&#160;&#34;PrivateMethods&#34;</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;introduced&#160;text&#160;according&#160;to&#160;Me&#46;amAllow&#160;property&#160;and&#160;<br />
&#160;&#160;&#160;&#160;&#39;&#160;returns&#160;True&#160;only&#160;when&#160;introduced&#160;text&#160;respects&#160;desired&#160;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Me&#46;amAllow&#160;property&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;CheckText&#40;&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Select&#160;Case&#160;Me&#46;aAllow<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NothingAtAll<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;no&#160;character&#160;has&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;PositiveInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;a&#160;right&#160;positive&#160;integer&#160;has&#160;been&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;IsPositiveInteger&#40;Me&#46;Text&#41;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NegativeInteger<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;a&#160;right&#160;negative&#160;integer&#160;has&#160;been&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;IsNegativeInteger&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;IsPositiveInteger&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;PositiveDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;a&#160;right&#160;positive&#160;double&#160;has&#160;been&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;IsPositiveDouble&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;IsPositiveInteger&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;NegativeDouble<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;a&#160;right&#160;negative&#160;double&#160;has&#160;been&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;IsNegativeDouble&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;IsPositiveDouble&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;IsNegativeInteger&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;IsPositiveInteger&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;OnlyLetter<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#160;only&#160;letters&#160;have&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;HasOnlyLetters&#40;Me&#46;Text&#41;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;OnlyLetterOrDigit&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Introduction&#46;Password<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;only&#160;letters&#160;and&#160;digits&#160;have&#160;been&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;Me&#46;HasOnlyLettersOrDigits&#40;Me&#46;Text&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Or&#160;Me&#46;Text&#160;&#61;&#160;&#34;&#34;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Case&#160;Introduction&#46;Everything&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Introduction&#46;EverythingNonCasing<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Allowing&#160;everything&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;Select<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;a&#160;right&#160;positive&#160;integer&#160;has&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;IsPositiveInteger&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsDigit&#40;C&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;a&#160;right&#160;negative&#160;integer&#160;has&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;IsNegativeInteger&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsDigit&#40;C&#41;&#160;OrElse&#160;C&#160;&#61;&#160;ChrW&#40;ASC&#95;DASH&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#58;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;first&#160;character&#160;is&#160;a&#160;dash&#160;character&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;length&#160;must&#160;be&#160;at&#160;least&#160;2&#160;characters&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R&#160;And&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;DASH&#41;&#41;&#160;&#61;&#160;0&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;Length&#160;&#62;&#61;&#160;2<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;a&#160;right&#160;positive&#160;double&#160;has&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;IsPositiveDouble&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsDigit&#40;C&#41;&#160;OrElse&#160;C&#160;&#61;&#160;ChrW&#40;ASC&#95;COMMA&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#58;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;there&#39;s&#160;one&#160;comma&#160;character&#160;and&#160;it&#39;s&#160;not&#160;the&#160;first&#160;one&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;there&#39;s&#160;exactly&#160;only&#160;one&#160;comma&#160;character&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;the&#160;comma&#160;character&#160;it&#39;s&#160;not&#160;the&#160;last&#160;one&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R&#160;And&#160;S&#46;IndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#62;&#160;0&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;IndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#61;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#60;&#160;S&#46;Length&#160;&#45;&#160;1<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;a&#160;right&#160;negative&#160;double&#160;has&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;IsNegativeDouble&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsDigit&#40;C&#41;&#160;OrElse&#160;C&#160;&#61;&#160;ChrW&#40;ASC&#95;DASH&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;OrElse&#160;C&#160;&#61;&#160;ChrW&#40;ASC&#95;COMMA&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Checking&#58;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;first&#160;character&#160;is&#160;a&#160;dash&#160;character&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;length&#160;must&#160;be&#160;at&#160;least&#160;4&#160;characters&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;there&#39;s&#160;one&#160;comma&#160;character&#160;and&#160;it&#39;s&#160;not&#160;the&#160;first&#160;or&#160;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#160;&#160;second&#160;one&#160;&#40;&#45;0&#44;0&#41;&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;there&#39;s&#160;exactly&#160;only&#160;one&#160;comma&#160;character&#44;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;&#160;&#160;&#45;&#160;the&#160;comma&#160;character&#160;it&#39;s&#160;not&#160;the&#160;last&#160;one&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R&#160;And&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;DASH&#41;&#41;&#160;&#61;&#160;0&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;Length&#160;&#62;&#61;&#160;4&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;IndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#62;&#160;1&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;IndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#61;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;And&#160;S&#46;LastIndexOf&#40;ChrW&#40;ASC&#95;COMMA&#41;&#41;&#160;&#60;&#160;S&#46;Length&#160;&#45;&#160;1<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;only&#160;letters&#160;have&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;HasOnlyLetters&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsLetter&#40;C&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Checks&#160;only&#160;letters&#160;and&#160;digits&#160;have&#160;been&#160;introduced&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Function&#160;HasOnlyLettersOrDigits&#40;ByVal&#160;S&#160;As&#160;String&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;R&#160;As&#160;Boolean<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;Not&#160;String&#46;IsNullOrEmpty&#40;S&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;IT&#160;As&#160;IEnumerator&#160;&#61;&#160;S&#46;GetEnumerator&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;C&#160;As&#160;Char<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;True<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;While&#160;IT&#46;MoveNext&#160;And&#160;R<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;C&#160;&#61;&#160;DirectCast&#40;IT&#46;Current&#44;&#160;Char&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;Char&#46;IsLetterOrDigit&#40;C&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;While<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;R&#160;&#61;&#160;False<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;R<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#35;End&#160;Region</p>
<p>End&#160;Class</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/12/textbox-mejorado-en-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Decidir clase en tiempo de ejecución en .NET.</title>
		<link>http://www.albertmata.net/2008/12/decidir-clase-en-tiempo-de-ejecucion-en-net/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=decidir-clase-en-tiempo-de-ejecucion-en-net</link>
		<comments>http://www.albertmata.net/2008/12/decidir-clase-en-tiempo-de-ejecucion-en-net/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 05:00:47 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[activator]]></category>
		<category><![CDATA[createinstance]]></category>
		<category><![CDATA[gettype]]></category>
		<category><![CDATA[type]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=161</guid>
		<description><![CDATA[En ocasiones puede resultarnos imprescindible no determinar la clase de la que un objeto va a ser instancia hasta que estemos en tiempo de ejecución. Para ello podemos valernos de la clase Activator y de su método CreateInstance, que nos permiten pasarle una clase para que nos devuelva un objeto de esa clase.
Podemos por ejemplo [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/11/visualstudio.jpg" alt="" title="visualstudio" width="299" height="94" class="alignleft size-full wp-image-144" />En ocasiones puede resultarnos imprescindible no determinar la clase de la que un objeto va a ser instancia hasta que estemos en tiempo de ejecución. Para ello podemos valernos de la clase Activator y de su método CreateInstance, que nos permiten pasarle una clase para que nos devuelva un objeto de esa clase.</p>
<p>Podemos por ejemplo crearnos una función sencilla como esta...</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Creates&#160;an&#160;instance&#160;of&#160;specified&#160;class&#160;and&#160;returns&#160;that&#160;object&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Public&#160;Function&#160;CreateInstance&#40;ByVal&#160;T&#160;As&#160;Type&#41;&#160;As&#160;Object<br />
&#160;&#160;&#160;&#160;Return&#160;Activator&#46;CreateInstance&#40;T&#41;<br />
End&#160;Function</div>
<p>...que podríamos tener encapsulada como método de alguna clase que nos permitiera hacer determinadas acciones con objetos, esto ya a gusto de cada cual.</p>
<p>Una vez tenemos esta función podemos llamarla de varias maneras. La primera, si tenemos otro objeto de la misma clase de la que ahora queremos obtener una instancia:</p>
<div class="code">Dim&#160;OBJ&#160;As&#160;Object</p>
<p>&#39;Option&#160;1&#46;&#160;We&#160;already&#160;have&#160;an&#160;object&#160;of&#160;that&#160;class&#46;<br />
Dim&#160;C1&#160;As&#160;New&#160;Class1&#40;&#41;<br />
OBJ&#160;&#61;&#160;Me&#46;CreateInstance&#40;C1&#46;GetType&#40;&#41;&#41;</p></div>
<p>La segunda, si no tenemos ningún objeto pero conocemos el nombre de la clase en cuestión:</p>
<div class="code">Dim&#160;OBJ&#160;As&#160;Object</p>
<p>&#39;Option&#160;2&#46;&#160;We&#160;haven&#39;t&#160;any&#160;object&#160;of&#160;that&#160;class&#46;<br />
OBJ&#160;&#61;&#160;Me&#46;CreateInstance&#40;Type&#46;GetType&#40;&#34;AlbertMata&#46;Class2&#34;&#41;&#41;</p>
<p>&#39;But&#160;be&#160;careful&#160;because&#160;this&#160;would&#160;fail&#58;<br />
&#39;OBJ&#160;&#61;&#160;Me&#46;CreateInstance&#40;Type&#46;GetType&#40;&#34;Class2&#34;&#41;&#41;</p></div>
<p>Como aparece en el código, conviene remarcar que el nombre de la clase debe incorporar el espacio de nombres, de lo contrario provocará una excepción.</p>
<p>En ambos casos, si una vez creado el objeto -que si nos fijamos lo habíamos declarado como Object y lo habíamos instanciado a través de un método que también devolvía un Object- consultamos su tipo exacto...</p>
<div class="code">&#39;Checking&#160;exact&#160;type&#160;for&#160;object&#46;<br />
Debug&#46;Print&#40;OBJ&#46;GetType&#46;ToString&#41;</div>
<p>...obtendremos...</p>
<div class="code">AlbertMata.Class2</div>
<p>Particularmente este sistema me ha venido bien para alguna travesura que quería hacer con formularios, pero creo que en más ocasiones podrá serme útil.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/12/decidir-clase-en-tiempo-de-ejecucion-en-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Distancia de Levenshtein en VisualBasic.NET.</title>
		<link>http://www.albertmata.net/2008/12/distancia-de-levenshtein-en-visualbasicnet/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=distancia-de-levenshtein-en-visualbasicnet</link>
		<comments>http://www.albertmata.net/2008/12/distancia-de-levenshtein-en-visualbasicnet/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 19:30:08 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[levenshtein]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=164</guid>
		<description><![CDATA[Hace un rato se me ha planteado un problema que quien más quien menos habrá tenido en alguna ocasión. Necesitaba poder comparar dos cadenas y obtener algún indicador de hasta qué punto podría tratarse de la misma cadena escrita de maneras ligeramente diferentes. He estado dándole vueltas sobre cómo podría jugar con los distintos métodos [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/12/levenshtein.png" alt="" title="levenshtein" width="240" height="226" class="alignleft size-full wp-image-165" />Hace un rato se me ha planteado un problema que quien más quien menos habrá tenido en alguna ocasión. Necesitaba poder comparar dos cadenas y obtener algún indicador de hasta qué punto podría tratarse de la misma cadena escrita de maneras ligeramente diferentes. He estado dándole vueltas sobre cómo podría jugar con los distintos métodos de la clase String para conseguir algún valor. Me he planteado utilizar análisis de frecuencias, generar números ponderados en función de carácter y posición dentro de la cadena... Pero nada me convencía, así que he insistido un poco más en buscar si ya alguien había desarrollado alguna función parecida y para mi mayúscula sorpresa me he dado de bruces con <a href="http://es.wikipedia.org/wiki/Distancia_de_Levenshtein" target="_blank">la Distancia de Levenshtein</a>.</p>
<p>Resulta que esto que andaba buscando es exactamente esta distancia. Y tal como reza la Wikipedia... "se llama Distancia de Levenshtein o distancia de edición al número mínimo de operaciones requeridas para transformar una cadena de caracteres en otra. Se entiende por operación, bien una inserción, eliminación o la substitución de un carácter. Esta distancia recibe ese nombre en honor al científico ruso Vladimir Levenshtein, quien se ocupara de esta distancia en 1965. Es útil en programas que determinan cuán similares son dos cadenas de caracteres, como es el caso de los correctores de ortografía."</p>
<p>Y para mayor regocijo, en la propia página de la Wikipedia aparece el algoritmo en pseudocódigo de la función:</p>
<div class="code">int&#160;LevenshteinDistance&#40;char&#160;str1&#91;1&#46;&#46;lenStr1&#93;&#44;&#160;char&#160;str2&#91;1&#46;&#46;lenStr2&#93;&#41;<br />
&#160;&#160;&#160;&#47;&#47;&#160;d&#160;is&#160;a&#160;table&#160;with&#160;lenStr1&#43;1&#160;rows&#160;and&#160;lenStr2&#43;1&#160;columns<br />
&#160;&#160;&#160;declare&#160;int&#160;d&#91;0&#46;&#46;lenStr1&#44;&#160;0&#46;&#46;lenStr2&#93;<br />
&#160;&#160;&#160;&#47;&#47;&#160;i&#160;and&#160;j&#160;are&#160;used&#160;to&#160;iterate&#160;over&#160;str1&#160;and&#160;str2<br />
&#160;&#160;&#160;declare&#160;int&#160;i&#44;&#160;j&#44;&#160;cost<br />
&#160;<br />
&#160;&#160;&#160;for&#160;i&#160;from&#160;0&#160;to&#160;lenStr1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;i&#44;&#160;0&#93;&#160;&#58;&#61;&#160;i<br />
&#160;&#160;&#160;for&#160;j&#160;from&#160;0&#160;to&#160;lenStr2<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;0&#44;&#160;j&#93;&#160;&#58;&#61;&#160;j<br />
&#160;<br />
&#160;&#160;&#160;for&#160;i&#160;from&#160;1&#160;to&#160;lenStr1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;for&#160;j&#160;from&#160;1&#160;to&#160;lenStr2<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;if&#160;str1&#91;i&#93;&#160;&#61;&#160;str2&#91;j&#93;&#160;then&#160;cost&#160;&#58;&#61;&#160;0<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;else&#160;cost&#160;&#58;&#61;&#160;1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;i&#44;&#160;j&#93;&#160;&#58;&#61;&#160;minimum&#40;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;i&#45;1&#44;&#160;j&#93;&#160;&#43;&#160;1&#44;&#160;&#160;&#160;&#160;&#160;&#47;&#47;&#160;deletion<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;i&#44;&#160;j&#45;1&#93;&#160;&#43;&#160;1&#44;&#160;&#160;&#160;&#160;&#160;&#47;&#47;&#160;insertion<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;d&#91;i&#45;1&#44;&#160;j&#45;1&#93;&#160;&#43;&#160;cost&#160;&#160;&#160;&#47;&#47;&#160;substitution<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#41;<br />
&#160;<br />
&#160;&#160;&#160;return&#160;d&#91;lenStr1&#44;&#160;lenStr2&#93;</div>
<p>Incluso viene la implementación en algunos lenguajes de programación (C++, Java, Perl, Python, Ruby, Delphi y ColdFusion). Lástima que no viniera también en VisualBasic.NET que es el lenguaje en el que yo desarrollo... pero bueno, como codificar un algoritmo que ya nos viene dado en pseudocódigo tampoco es tarea infernal, a ello me he dedicado:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Date&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;20081212<br />
&#39;&#160;Description&#58;&#160;Calculates&#160;Levenshtein&#160;distance&#160;between&#160;two&#160;different&#160;<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;strings&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Public&#160;Function&#160;LevenshteinDistance&#40;ByVal&#160;STR1&#160;As&#160;String&#44;&#160;&#95;<br />
ByVal&#160;STR2&#160;As&#160;String&#41;&#160;As&#160;Integer<br />
&#160;&#160;&#160;&#160;&#39;Variables&#160;to&#160;iterate&#160;&#40;i&#44;&#160;j&#41;&#160;and&#160;get&#160;cost&#160;for&#160;any&#160;needed&#160;<br />
&#160;&#160;&#160;&#160;&#39;operation&#46;<br />
&#160;&#160;&#160;&#160;Dim&#160;i&#160;As&#160;Integer<br />
&#160;&#160;&#160;&#160;Dim&#160;j&#160;As&#160;Integer<br />
&#160;&#160;&#160;&#160;Dim&#160;Cost&#160;As&#160;Integer</p>
<p>&#160;&#160;&#160;&#160;&#39;Creating&#160;array&#160;with&#160;string&#39;s&#160;lengths&#160;as&#160;bounds&#46;<br />
&#160;&#160;&#160;&#160;Dim&#160;D&#40;STR1&#46;Length&#44;&#160;STR2&#46;Length&#41;&#160;As&#160;Integer</p>
<p>&#160;&#160;&#160;&#160;&#39;Initializing&#160;array&#39;s&#160;values&#46;<br />
&#160;&#160;&#160;&#160;For&#160;i&#160;&#61;&#160;0&#160;To&#160;STR1&#46;Length<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D&#40;i&#44;&#160;0&#41;&#160;&#61;&#160;i<br />
&#160;&#160;&#160;&#160;Next<br />
&#160;&#160;&#160;&#160;For&#160;j&#160;&#61;&#160;0&#160;To&#160;STR2&#46;Length<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D&#40;0&#44;&#160;j&#41;&#160;&#61;&#160;j<br />
&#160;&#160;&#160;&#160;Next</p>
<p>&#160;&#160;&#160;&#160;&#39;Calculating&#160;Levenshtein&#160;distance&#46;<br />
&#160;&#160;&#160;&#160;For&#160;i&#160;&#61;&#160;1&#160;To&#160;STR1&#46;Length<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;j&#160;&#61;&#160;1&#160;To&#160;STR2&#46;Length<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;STR1&#40;i&#160;&#45;&#160;1&#41;&#160;&#61;&#160;STR2&#40;j&#160;&#45;&#160;1&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Cost&#160;&#61;&#160;0<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Cost&#160;&#61;&#160;1<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;First&#160;compared&#160;element&#58;&#160;deletion&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Second&#160;compared&#160;element&#58;&#160;insertion&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Third&#160;compared&#160;element&#58;&#160;substitution&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D&#40;i&#44;&#160;j&#41;&#160;&#61;&#160;Math&#46;Min&#40;Math&#46;Min&#40;D&#40;i&#160;&#45;&#160;1&#44;&#160;j&#41;&#160;&#43;&#160;1&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D&#40;i&#44;&#160;j&#160;&#45;&#160;1&#41;&#160;&#43;&#160;1&#41;&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;D&#40;i&#160;&#45;&#160;1&#44;&#160;j&#160;&#45;&#160;1&#41;&#160;&#43;&#160;Cost&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next<br />
&#160;&#160;&#160;&#160;Next</p>
<p>&#160;&#160;&#160;&#160;&#39;Returning&#160;result&#46;<br />
&#160;&#160;&#160;&#160;Return&#160;D&#40;STR1&#46;Length&#44;&#160;STR2&#46;Length&#41;<br />
End&#160;Function</p></div>
<p>Creo que está bien. Y el resultado de algunas pruebas así parece demostrarlo:</p>
<div class="code">Debug&#46;Print&#40;Me&#46;LevenshteinDistance&#40;&#34;Albert&#160;Mata&#34;&#44;&#160;&#34;Albert&#160;Mata&#34;&#41;&#41;<br />
0<br />
Debug&#46;Print&#40;Me&#46;LevenshteinDistance&#40;&#34;Albert&#160;Mata&#34;&#44;&#160;&#34;Alber&#160;Matas&#34;&#41;&#41;<br />
2<br />
Debug&#46;Print&#40;Me&#46;LevenshteinDistance&#40;&#34;Albert&#160;Mata&#34;&#44;&#160;&#34;Mr&#46;&#160;Albert&#160;Mata&#34;&#41;&#41;<br />
4</div>
<p>No es ni mucho menos un sistema infalible, pero nos puede resultar muy útil para estimar si dos cadenas algo distintas pueden ser (o pretender ser) en realidad la misma. No obstante hay que utilizarla con cabeza, ya que por ejemplo si comparamos...</p>
<p>Albert Mata<br />
Antoni Pons</p>
<p>...obtendremos una distancia de 9. Y si comparamos...</p>
<p>Berberechos y enlatados del norte, S.A.<br />
Berberechos y enlatd. norte, SA</p>
<p>...obtendremos también una distancia de 9. Sin embargo en el primer caso las personas son claramente distintas y en el segundo caso el cliente parece ser el mismo. Para corregir esto se podrían buscar varias alternativas, pero yo propongo algo tan sencillo como ponderar la distancia entre la longitud de alguna de las cadenas:</p>
<div class="code">Dim&#160;S1&#160;As&#160;String&#160;&#61;&#160;&#34;Albert&#160;Mata&#34;<br />
Dim&#160;S2&#160;As&#160;String&#160;&#61;&#160;&#34;Antoni&#160;Pons&#34;<br />
Dim&#160;LD&#160;As&#160;Integer&#160;&#61;&#160;Me&#46;LevenshteinDistance&#40;S1&#44;&#160;S2&#41;<br />
Dim&#160;Similar&#160;As&#160;Double&#160;&#61;&#160;&#40;S1&#46;Length&#160;&#45;&#160;LD&#41;&#160;&#47;&#160;S1&#46;Length</div>
<p>Esto nos da un coeficiente de similitud del 0,181818181818182 (escaso, escaso). En cambio esto otro...</p>
<div class="code">Dim&#160;S1&#160;As&#160;String&#160;&#61;&#160;&#34;Berberechos&#160;y&#160;enlatados&#160;del&#160;norte&#44;&#160;S&#46;A&#46;&#34;<br />
Dim&#160;S2&#160;As&#160;String&#160;&#61;&#160;&#34;Berberechos&#160;y&#160;enlatd&#46;&#160;norte&#44;&#160;SA&#34;<br />
Dim&#160;LD&#160;As&#160;Integer&#160;&#61;&#160;Me&#46;LevenshteinDistance&#40;S1&#44;&#160;S2&#41;<br />
Dim&#160;Similar&#160;As&#160;Double&#160;&#61;&#160;&#40;S1&#46;Length&#160;&#45;&#160;LD&#41;&#160;&#47;&#160;S1&#46;Length</div>
<p>...nos da un coeficiente de similitud del 0,769230769230769 (¡mucho mejor!). Se tratará en cada caso de establecer dónde ponemos el límite.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/12/distancia-de-levenshtein-en-visualbasicnet/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Report in .NET using Crystal Reports and MySQL database.</title>
		<link>http://www.albertmata.net/2008/12/report-in-net-using-crystal-reports-and-mysql-database/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=report-in-net-using-crystal-reports-and-mysql-database</link>
		<comments>http://www.albertmata.net/2008/12/report-in-net-using-crystal-reports-and-mysql-database/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 06:00:08 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Crystal Reports]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[bases de datos]]></category>
		<category><![CDATA[connection string]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[datatable]]></category>
		<category><![CDATA[informe]]></category>
		<category><![CDATA[odbc]]></category>
		<category><![CDATA[report]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=148</guid>
		<description><![CDATA[This is just the first of some English posts that I'll publish by translating most popular posts in this blog. Original version (in Spanish) is here.
First of all, I must asume that creating reports is one of that things I like worst in programming. But it's quite obvious that few serious applications don't need them, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-74" title="xmlreport" src="http://www.albertmata.net/public/uploads/2008/07/xmlreport.jpg" alt="" width="230" height="227" />This is just the first of some English posts that I'll publish by translating most popular posts in this blog. Original version (in Spanish) is <a href="http://www.albertmata.net/2008/07/informe-en-net-con-crystal-reports-y-base-de-datos-mysql/" target="_blank">here</a>.</p>
<p>First of all, I must asume that creating reports is one of that things I like worst in programming. But it's quite obvious that few serious applications don't need them, and the one I'm developing now isn't an exception to this rule. So I've been creating some reports recently and I've discovered a new way to do it. And that's what I explain in this post.</p>
<p>As I've said sometimes before in previous posts, I develop with VisualBasic.NET and MySQL database. And I use Crystal Reports to create reports, as this tool is integrated in VisualStudio.NET. Since now, I used to use an ODBC connection configured in each PC to connect to MySQL server. But I didn't like this system much, because actually I'm not working just with one database but with some with different names. They have the same structure, tables and data, but just one is the good one, as the rest are just for developing purposes. It's really easy to use one or other connection string to make the application connect with one or other database, but with reports it isn't so easy as they take data using that ODBC connection (and it just can connect with one database).</p>
<p>But now I've discovered how to create reports with just a DataTable and an XML schema, needing nothing else. Actually it's possible to use a DataSet instead of a DataTable as well. So I'm going to explain it with an easy example and some images.</p>
<p>I'll work with two tables in my MySQL database where I'll keep information about bills. First table is the one with information about headers and has this data:</p>
<div class="code">&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;blh&#95;num&#160;&#124;&#160;blh&#95;dat&#160;&#160;&#160;&#160;&#124;&#160;blh&#95;cus&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;2008&#45;07&#45;30&#160;&#124;&#160;CERAMICAS&#160;PEPE&#44;&#160;S&#46;A&#46;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#124;&#160;2008&#45;07&#45;30&#160;&#124;&#160;TALLERES&#160;GOMEZ&#44;&#160;S&#46;L&#46;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3&#160;&#124;&#160;2008&#45;07&#45;31&#160;&#124;&#160;DEPORTES&#160;DAMIAN&#44;&#160;S&#46;L&#46;&#160;&#160;&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;2008&#45;07&#45;31&#160;&#124;&#160;SOFTWARE&#160;ALBERTMATA&#46;NET&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;</div>
<p>Second table is the one with information about positions and has this rows:</p>
<div class="code">&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;blp&#95;num&#160;&#124;&#160;blp&#95;pos&#160;&#124;&#160;blp&#95;art&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;blp&#95;pri&#160;&#124;&#160;blp&#95;qty&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;RATON&#160;LOGITECH&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;15&#46;95&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;MONITOR&#160;LG&#160;19&#160;PULGADAS&#160;&#124;&#160;&#160;&#160;210&#46;5&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;ROUTER&#160;DLINK&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;56&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;&#160;RATON&#160;LOGITECH&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;15&#46;95&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;2&#160;&#124;&#160;TECLADO&#160;LOGITECH&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;12&#46;95&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;3&#160;&#124;&#160;RECEPTOR&#160;GPS&#160;ZAPPA&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;59&#46;95&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;1&#160;&#124;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;&#160;PAQUETE&#160;500&#160;FOLIOS&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;&#160;&#160;&#160;3&#46;7&#160;&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;4&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;</div>
<p>It's something really simple and not <a href="http://en.wikipedia.org/wiki/Database_normalization" target="_blank">normalized</a>, but will be enough for this example, as we're going to create a report that will be the inovice for purchase number 4 (the one with customer SOFTWARE ALBERTMATA.NET). Obviously, we'll need information about both tables but I just want to work with one DataTable, so first of all I'm going to create a MySQL view with this sentence:</p>
<div class="code">CREATE&#160;VIEW&#160;zbl&#95;bill2print&#160;AS&#160;<br />
&#40;<br />
SELECT<br />
&#160;&#160;&#160;&#160;blh&#95;num&#160;AS&#160;BILL&#95;NUMBER&#44;<br />
&#160;&#160;&#160;&#160;blh&#95;dat&#160;AS&#160;BILL&#95;DATE&#44;<br />
&#160;&#160;&#160;&#160;blh&#95;cus&#160;AS&#160;BILL&#95;CUSTOMER&#44;<br />
&#160;&#160;&#160;&#160;blp&#95;pos&#160;AS&#160;LINE&#95;NUMBER&#44;<br />
&#160;&#160;&#160;&#160;blp&#95;art&#160;AS&#160;LINE&#95;ARTICLE&#44;<br />
&#160;&#160;&#160;&#160;blp&#95;pri&#160;AS&#160;LINE&#95;UNITPRICE&#44;<br />
&#160;&#160;&#160;&#160;blp&#95;qty&#160;AS&#160;LINE&#95;UNITS&#44;<br />
&#160;&#160;&#160;&#160;blp&#95;pri&#160;&#42;&#160;blp&#95;qty&#160;AS&#160;LINE&#95;TOTALPRICE<br />
FROM<br />
&#160;&#160;&#160;&#160;blh&#95;billheader&#160;LEFT&#160;JOIN&#160;blp&#95;billposits&#160;ON&#160;blh&#95;num&#160;&#61;&#160;blp&#95;num<br />
WHERE<br />
&#160;&#160;&#160;&#160;blh&#95;num&#160;&#61;&#160;4<br />
&#41;&#59;</div>
<p>So, from now on the report will be created using this zbl_bill2print view. Let's go with the .NET part.</p>
<div class="subtitle">Step 1. Creating XML file containing table/view structure.</div>
<p>Along this post we'll work with these three things:</p>
<p>1) a Windows form (frmMain) where we'll have the report viewer object.<br />
2) a class (clsReportCreator) we're going to create right now.<br />
3) a report (rptBill) that will be the invoice we want to print.</p>
<p>So let's start creating clsReportCreator class. It'll have only one attribute (the name of the table or view), one constructor method, one method to load DataTable object and one last method to generate the XML file. Here is the full code for this class:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Date&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;20080731<br />
&#39;&#160;Needs&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MySQL&#46;Data&#160;reference&#46;<br />
&#39;&#160;Description&#58;&#160;Class&#160;to&#160;create&#160;a&#160;report&#160;using&#160;just&#160;an&#160;XML&#160;file&#46;&#160;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Imports&#160;MySql&#46;Data&#46;MySqlClient</p>
<p>Public&#160;Class&#160;clsReportCreator</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Attributes&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;TableOrView&#160;As&#160;String</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Constructor&#160;method&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;New&#40;ByVal&#160;TableOrView&#160;As&#160;String&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;TableOrView&#160;&#61;&#160;TableOrView<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Returns&#160;DataTable&#160;corresponding&#160;to&#160;TableOrView&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Function&#160;GetDataTable&#40;&#41;&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DA&#160;As&#160;MySqlDataAdapter<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DS&#160;As&#160;New&#160;DataSet<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;ConnectionString&#160;As&#160;String<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;SQL&#160;As&#160;String</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;connection&#160;string&#160;to&#160;connect&#160;to&#160;MySQL&#160;database&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;ConnectionString&#160;&#61;&#160;&#34;Database&#160;&#61;&#160;blog&#59;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#34;Data&#160;Source&#160;&#61;&#160;localhost&#59;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#34;User&#160;ID&#160;&#61;&#160;root&#59;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#34;Password&#160;&#61;&#160;mypassword&#34;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;SQL&#160;string&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;SQL&#160;&#61;&#160;&#34;SELECT&#160;&#42;&#160;FROM&#160;&#34;&#160;&#38;&#160;Me&#46;TableOrView</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Getting&#160;data&#160;and&#160;filling&#160;DataSet&#160;and&#160;DataTable&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DA&#160;&#61;&#160;New&#160;MySqlDataAdapter&#40;SQL&#44;&#160;ConnectionString&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DA&#46;Fill&#40;DS&#44;&#160;Me&#46;TableOrView&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#160;&#61;&#160;DS&#46;Tables&#40;Me&#46;TableOrView&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Returning&#160;DataTable&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;DT<br />
&#160;&#160;&#160;&#160;End&#160;Function</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Creates&#160;XML&#160;file&#160;in&#160;desired&#160;path&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Public&#160;Sub&#160;CreateXMLFile&#40;ByVal&#160;FilePath&#160;As&#160;String&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;DataTable&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#160;&#61;&#160;Me&#46;GetDataTable&#40;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Writting&#160;XML&#160;file&#160;in&#160;desired&#160;path&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;DT&#46;WriteXmlSchema&#40;FilePath&#160;&#38;&#160;Me&#46;TableOrView&#160;&#38;&#160;&#34;&#46;xml&#34;&#41;<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>End&#160;Class</p></div>
<p>And we also create frmMain form, which only code by the moment will be this:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Date&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;20080731<br />
&#39;&#160;Description&#58;&#160;Form&#160;to&#160;show&#160;how&#160;to&#160;create&#160;a&#160;report&#160;using&#160;just&#160;an&#160;XML<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;file&#46;&#160;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Public&#160;Class&#160;frmMain</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;As&#160;a&#160;first&#160;step&#44;&#160;creates&#160;XML&#160;file&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;frmMain&#95;Load&#40;ByVal&#160;sender&#160;As&#160;System&#46;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;MyBase&#46;Load<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;XML&#160;file&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;RC&#160;As&#160;New&#160;clsReportCreator&#40;&#34;zbl&#95;bill2print&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;RC&#46;CreateXMLFile&#40;&#34;C&#58;&#92;&#34;&#41;<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>End&#160;Class</p></div>
<p>Right now we have a first application. If we execute it we'll get C:\zbl_bill2print.xml file with the structure of zbl_bill2print view. So we run it and get <a href="http://www.albertmata.net/files/zbl_bill2print.xml" target="_blank">that file</a>.</p>
<div class="subtitle">Step 2. Creating report and loading data source.</div>
<p>First, we add a report to our project and give it a name like rptBill.rpt. We create it choosing empty report option, so desestimating any templates.</p>
<p>Now we go to Fields explorer menu and right-click the first option (Database fields). In new contextual menu we click on Database assistant option.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-75" title="blog_020_1" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_1.jpg" alt="" width="224" height="147" /></p>
<p>After this we get the Available data source menu, where we choose Create new connection and after that ADO.NET option.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-76" title="blog_020_2" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_2.jpg" alt="" width="232" height="305" /></p>
<p>Making this, we'll see a new form where we'll be asked about File's path. In this point we have to find XML file we've created before (in my example C:\zbl_bill2print.xml) and then press Finish. We have NewDataSet option including our just added zbl_bill2print in Available data source menu now. </p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-77" title="blog_020_3" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_3.jpg" alt="" width="232" height="305" /></p>
<p>So we select it and press button to move it to Selected tables menu. Done this, it's time to click on Accept.</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-78" title="blog_020_4" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_4.jpg" alt="" width="231" height="305" /></p>
<p>With all this stuff we've gotten that zbl_bill2print structure available in Fields explorer menu with all its fields, as shown in image below:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-79" title="blog_020_5" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_5.jpg" alt="" width="224" height="311" /></p>
<div class="subtitle">Step 3. Designing report.</div>
<p>Nothing special to say here. Just adding fields from Fields explorer menu, inserting text objects where needed, sums, text formats, images and so on...</p>
<p>I've just created a very simple design like this:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-80" title="blog_020_6" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_6.jpg" alt="" width="399" height="313" /></p>
<div class="subtitle">Step 4. Last actions to get the invoice.</div>
<p>Finally we're going to create the bill. To do that, we add a CrystalReportViewer object in frmMain form. I call it crvBill. After that it's necessary to modify frmMain source code to make it look like this:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Date&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;20080731<br />
&#39;&#160;Description&#58;&#160;Form&#160;to&#160;show&#160;how&#160;to&#160;create&#160;a&#160;report&#160;using&#160;just&#160;an&#160;XML<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;file&#46;&#160;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Imports&#160;CrystalDecisions&#46;CrystalReports&#46;Engine</p>
<p>Public&#160;Class&#160;frmMain</p>
<p>&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;&#39;&#160;Creates&#160;XML&#160;file&#160;&#40;just&#160;once&#41;&#160;and&#160;creates&#160;and&#160;loads&#160;a&#160;report&#46;<br />
&#160;&#160;&#160;&#160;&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#160;&#160;&#160;&#160;Private&#160;Sub&#160;frmMain&#95;Load&#40;ByVal&#160;sender&#160;As&#160;System&#46;Object&#44;&#160;&#95;<br />
&#160;&#160;&#160;&#160;ByVal&#160;e&#160;As&#160;System&#46;EventArgs&#41;&#160;Handles&#160;MyBase&#46;Load<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;XML&#160;file&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;RC&#160;As&#160;New&#160;clsReportCreator&#40;&#34;zbl&#95;bill2print&#34;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;RC&#46;CreateXMLFile&#40;&#34;C&#58;&#92;&#34;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Creating&#160;report&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;RD&#160;As&#160;ReportDocument&#160;&#61;&#160;New&#160;rptBill&#40;&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;data&#160;source&#160;for&#160;report&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;DT&#160;As&#160;DataTable&#160;&#61;&#160;RC&#46;GetDataTable&#40;&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;RD&#46;SetDataSource&#40;DT&#41;</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;data&#160;source&#160;for&#160;possible&#160;subreports&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;Each&#160;SR&#160;As&#160;ReportDocument&#160;In&#160;RD&#46;Subreports<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;If&#160;SR&#46;Database&#46;Tables&#46;Count&#160;&#62;&#160;0&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;SR&#46;SetDataSource&#40;DT&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;End&#160;If<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#39;Setting&#160;recently&#160;created&#160;report&#160;must&#160;be&#160;shown&#160;in&#160;viewer&#46;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Me&#46;crvBill&#46;ReportSource&#160;&#61;&#160;RD<br />
&#160;&#160;&#160;&#160;End&#160;Sub</p>
<p>End&#160;Class</p></div>
<p>It's important to note that the line where the XML file is created is commented now, as we just need to create this file once to use it to create the source data, but from now on we don't need to generate it every time.</p>
<p>What we're mainly doing in this code is:</p>
<p>1) creating a report object same kind we've designed in step 3,<br />
2) getting a DataTable with data we want to show (in this example and according to the way we've defined MySQL view, we want to show invoice number 4),<br />
3) setting this DataTable as the report's source data,<br />
4) asking CrystalReportViewer to show this report.</p>
<p>We execute the application again and get desired invoice:</p>
<p style="text-align: center;"><img class="alignnone size-full wp-image-81" title="blog_020_7" src="http://www.albertmata.net/public/uploads/2008/07/blog_020_7.jpg" alt="" width="484" height="416" /></p>
<p>Of course there should be quite more information, images and legal texts in a real invoice, but this is just an easy example of how to do the report itself.</p>
<p>So we've seen how to create a report in VisualBasic.NET just using an XML file. Of course there are plenty of things to improve, as optimizing how database connection is done, or avoiding WHERE condition directly in MySQL view and so on... but what I was looking for with this example was just a very minimum guide to show the process.</p>
<p>PS. Some menu and option names can be different as I develope in VisualStudio Spanish version and I've just translated them as I've thought they could appear in English version. Sorry about that!</p>
<div class="subtitle">Update.</div>
<p> There is a second part for this post <a href="http://www.albertmata.net/2008/10/pasando-parametros-al-informe-en-net-con-crystal-reports/" target="_blank">explaining how to pass parameters from form to report</a>, but it's still only in Spanish.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/12/report-in-net-using-crystal-reports-and-mysql-database/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>ReDim Preserve para cambiar más de una dimensión en .NET.</title>
		<link>http://www.albertmata.net/2008/11/redim-preserve-para-cambiar-mas-de-una-dimension-en-net/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=redim-preserve-para-cambiar-mas-de-una-dimension-en-net</link>
		<comments>http://www.albertmata.net/2008/11/redim-preserve-para-cambiar-mas-de-una-dimension-en-net/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 07:04:21 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[int32]]></category>
		<category><![CDATA[preserve]]></category>
		<category><![CDATA[redim]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=143</guid>
		<description><![CDATA[Recientemente en grupos de .NET salió el tema de cómo se pueden redimensionar las dos dimensiones de una matriz de dos dimensiones sin perder los valores que ya se tienen almacenados en dicha matriz.
Si fuera una matriz de una dimensión no habría ningún problema, ya que la opción Preserve nos permite hacer precisamente eso:
Dim&#160;myArray&#40;3&#41;&#160;As&#160;Int32
myArray&#40;0&#41;&#160;&#61;&#160;2
myArray&#40;1&#41;&#160;&#61;&#160;4
myArray&#40;2&#41;&#160;&#61;&#160;6
myArray&#40;3&#41;&#160;&#61;&#160;8
ReDim&#160;Preserve&#160;myArray&#40;5&#41;
myArray&#40;4&#41;&#160;&#61;&#160;10
myArray&#40;5&#41;&#160;&#61;&#160;12
Así, este [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/11/visualstudio.jpg" alt="" title="visualstudio" width="299" height="94" class="alignleft size-full wp-image-144" />Recientemente en grupos de .NET salió el tema de cómo se pueden redimensionar las dos dimensiones de una matriz de dos dimensiones sin perder los valores que ya se tienen almacenados en dicha matriz.</p>
<p>Si fuera una matriz de una dimensión no habría ningún problema, ya que la opción Preserve nos permite hacer precisamente eso:</p>
<div class="code">Dim&#160;myArray&#40;3&#41;&#160;As&#160;Int32<br />
myArray&#40;0&#41;&#160;&#61;&#160;2<br />
myArray&#40;1&#41;&#160;&#61;&#160;4<br />
myArray&#40;2&#41;&#160;&#61;&#160;6<br />
myArray&#40;3&#41;&#160;&#61;&#160;8<br />
ReDim&#160;Preserve&#160;myArray&#40;5&#41;<br />
myArray&#40;4&#41;&#160;&#61;&#160;10<br />
myArray&#40;5&#41;&#160;&#61;&#160;12</div>
<p>Así, este código no da ningún problema. Y tampoco lo da este otro:</p>
<div class="code">Dim&#160;myArray&#40;3&#44;&#160;0&#41;&#160;As&#160;Int32<br />
myArray&#40;0&#44;&#160;0&#41;&#160;&#61;&#160;2<br />
myArray&#40;1&#44;&#160;0&#41;&#160;&#61;&#160;4<br />
myArray&#40;2&#44;&#160;0&#41;&#160;&#61;&#160;6<br />
myArray&#40;3&#44;&#160;0&#41;&#160;&#61;&#160;8<br />
ReDim&#160;Preserve&#160;myArray&#40;3&#44;&#160;1&#41;<br />
myArray&#40;0&#44;&#160;1&#41;&#160;&#61;&#160;10<br />
myArray&#40;1&#44;&#160;1&#41;&#160;&#61;&#160;12<br />
myArray&#40;2&#44;&#160;1&#41;&#160;&#61;&#160;14<br />
myArray&#40;3&#44;&#160;1&#41;&#160;&#61;&#160;1</div>
<p>Ya que aunque es una matriz de dos dimensiones, sólo estamos redimensionando la dimensión situada más a la derecha. En cambio si intentamos hacer esto que sigue:</p>
<div class="code">Dim&#160;myArray&#40;3&#44;&#160;0&#41;&#160;As&#160;Int32<br />
myArray&#40;0&#44;&#160;0&#41;&#160;&#61;&#160;2<br />
ReDim&#160;Preserve&#160;myArray&#40;4&#44;&#160;1&#41;<br />
myArray&#40;4&#44;&#160;1&#41;&#160;&#61;&#160;10</div>
<p>Nos dará una excepción de tipo ArrayTypeMismatchException y nos dirá que...</p>
<p><em>'ReDim' sólo puede cambiar la dimensión situada más a la derecha</em></p>
<p>...porque un ReDim Preserve en una matriz de dos dimensiones sólo puede actuar sobre la última dimensión.</p>
<p>Para solventar esto podemos utilizar la siguiente función:</p>
<div class="code">&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
&#39;&#160;Author&#58;&#160;&#160;&#160;&#160;&#160;&#160;Albert&#160;Mata&#160;&#40;www&#46;albertmata&#46;net&#41;<br />
&#39;&#160;Date&#58;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;20081118<br />
&#39;&#160;Description&#58;&#160;Simulates&#160;a&#160;ReDim&#160;Preserve&#160;action&#160;on&#160;2&#45;dimensions<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;arrays&#44;&#160;allowing&#160;to&#160;change&#160;not&#160;only&#160;the&#160;last&#160;dimension<br />
&#39;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;but&#160;both&#46;<br />
&#39;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;<br />
Public&#160;Function&#160;ReDimPreserve&#40;ByVal&#160;M&#160;As&#160;Array&#44;&#160;&#95;<br />
ByVal&#160;NewLimit0&#160;As&#160;Integer&#44;&#160;ByVal&#160;NewLimit1&#160;As&#160;Integer&#41;&#160;As&#160;Array<br />
&#160;&#160;&#160;&#160;If&#160;NewLimit0&#160;&#62;&#61;&#160;M&#46;GetUpperBound&#40;0&#41;&#160;&#95;<br />
&#160;&#160;&#160;&#160;And&#160;NewLimit1&#160;&#62;&#61;&#160;M&#46;GetUpperBound&#40;1&#41;&#160;Then<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Dim&#160;NewArray&#40;NewLimit0&#44;&#160;NewLimit1&#41;&#160;As&#160;&#91;Int32&#93;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;i&#160;As&#160;Integer&#160;&#61;&#160;0&#160;To&#160;M&#46;GetUpperBound&#40;0&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;For&#160;j&#160;As&#160;Integer&#160;&#61;&#160;0&#160;To&#160;M&#46;GetUpperBound&#40;1&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;NewArray&#46;SetValue&#40;M&#46;GetValue&#40;i&#44;&#160;j&#41;&#44;&#160;i&#44;&#160;j&#41;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Next<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;NewArray<br />
&#160;&#160;&#160;&#160;Else<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;Return&#160;M<br />
&#160;&#160;&#160;&#160;End&#160;If<br />
End&#160;Function</div>
<p>De tal manera que ahora ante el siguiente código, donde creamos una matriz inicialmente de dimensiones (2,3) para luego redimensionarla a (4,5) y por tanto cambiando las dos dimensiones de la matriz, sin perder los valores que ya teníamos almacenados...</p>
<div class="code">Debug&#46;Print&#40;&#34;Creating&#160;array&#160;with&#160;dimensions&#160;&#91;2&#44;3&#93;&#34;&#41;<br />
Dim&#160;myArray&#40;2&#44;&#160;3&#41;&#160;As&#160;&#91;Int32&#93;<br />
Debug&#46;Print&#40;&#34;Storing&#160;value&#160;12&#160;in&#160;position&#160;&#91;0&#44;2&#93;&#34;&#41;<br />
myArray&#46;SetValue&#40;12&#44;&#160;0&#44;&#160;2&#41;<br />
Debug&#46;Print&#40;&#34;Storing&#160;value&#160;15&#160;in&#160;position&#160;&#91;2&#44;3&#93;&#34;&#41;<br />
myArray&#46;SetValue&#40;15&#44;&#160;2&#44;&#160;3&#41;<br />
Debug&#46;Print&#40;&#34;Upper&#160;bound&#160;for&#160;first&#160;dimension&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#40;myArray&#46;GetUpperBound&#40;0&#41;&#41;&#41;<br />
Debug&#46;Print&#40;&#34;Upper&#160;bound&#160;for&#160;second&#160;dimension&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#40;myArray&#46;GetUpperBound&#40;1&#41;&#41;&#41;<br />
Debug&#46;Print&#40;&#34;Value&#160;in&#160;position&#160;&#91;0&#44;2&#93;&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;myArray&#46;GetValue&#40;0&#44;&#160;2&#41;&#46;ToString&#41;<br />
Debug&#46;Print&#40;&#34;Value&#160;in&#160;position&#160;&#91;2&#44;3&#93;&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;myArray&#46;GetValue&#40;2&#44;&#160;3&#41;&#46;ToString&#41;<br />
Try<br />
&#160;&#160;&#160;&#160;myArray&#46;SetValue&#40;24&#44;&#160;3&#44;&#160;4&#41;<br />
&#160;&#160;&#160;&#160;Debug&#46;Print&#40;&#34;I&#160;can&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;&#34;&#41;<br />
Catch&#160;ex&#160;As&#160;Exception<br />
&#160;&#160;&#160;&#160;Debug&#46;Print&#40;&#34;I&#160;can&#39;t&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;&#34;&#41;<br />
End&#160;Try</p>
<p>Debug&#46;Print&#40;&#34;Changing&#160;array&#160;dimensions&#160;to&#160;&#91;4&#44;5&#93;&#34;&#41;<br />
myArray&#160;&#61;&#160;DirectCast&#40;Me&#46;ReDimPreserve&#40;myArray&#44;&#160;4&#44;&#160;5&#41;&#44;&#160;Integer&#40;&#44;&#41;&#41;<br />
Debug&#46;Print&#40;&#34;Upper&#160;bound&#160;for&#160;first&#160;dimension&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#40;myArray&#46;GetUpperBound&#40;0&#41;&#41;&#41;<br />
Debug&#46;Print&#40;&#34;Upper&#160;bound&#160;for&#160;second&#160;dimension&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;&#40;myArray&#46;GetUpperBound&#40;1&#41;&#41;&#41;<br />
Debug&#46;Print&#40;&#34;Value&#160;in&#160;position&#160;&#91;0&#44;2&#93;&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;myArray&#46;GetValue&#40;0&#44;&#160;2&#41;&#46;ToString&#41;<br />
Debug&#46;Print&#40;&#34;Value&#160;in&#160;position&#160;&#91;2&#44;3&#93;&#160;&#61;&#160;&#34;&#160;&#95;<br />
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#38;&#160;myArray&#46;GetValue&#40;2&#44;&#160;3&#41;&#46;ToString&#41;<br />
Try<br />
&#160;&#160;&#160;&#160;myArray&#46;SetValue&#40;24&#44;&#160;3&#44;&#160;4&#41;<br />
&#160;&#160;&#160;&#160;Debug&#46;Print&#40;&#34;I&#160;can&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;&#34;&#41;<br />
Catch&#160;ex&#160;As&#160;Exception<br />
&#160;&#160;&#160;&#160;Debug&#46;Print&#40;&#34;I&#160;can&#39;t&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;&#34;&#41;<br />
End&#160;Try</p></div>
<p>...obtenemos esta salida en la Ventana Inmediato:</p>
<div class="code">Creating&#160;array&#160;with&#160;dimensions&#160;&#91;2&#44;3&#93;<br />
Storing&#160;value&#160;12&#160;in&#160;position&#160;&#91;0&#44;2&#93;<br />
Storing&#160;value&#160;15&#160;in&#160;position&#160;&#91;2&#44;3&#93;<br />
Upper&#160;bound&#160;for&#160;first&#160;dimension&#160;&#61;&#160;2<br />
Upper&#160;bound&#160;for&#160;second&#160;dimension&#160;&#61;&#160;3<br />
Value&#160;in&#160;position&#160;&#91;0&#44;2&#93;&#160;&#61;&#160;12<br />
Value&#160;in&#160;position&#160;&#91;2&#44;3&#93;&#160;&#61;&#160;15<br />
&#42;&#42;&#42;&#160;&#39;System&#46;IndexOutOfRangeException&#39;&#160;EXCEPTION&#160;&#42;&#42;&#42;<br />
I&#160;can&#39;t&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;<br />
Changing&#160;array&#160;dimensions&#160;to&#160;&#91;4&#44;5&#93;<br />
Upper&#160;bound&#160;for&#160;first&#160;dimension&#160;&#61;&#160;4<br />
Upper&#160;bound&#160;for&#160;second&#160;dimension&#160;&#61;&#160;5<br />
Value&#160;in&#160;position&#160;&#91;0&#44;2&#93;&#160;&#61;&#160;12<br />
Value&#160;in&#160;position&#160;&#91;2&#44;3&#93;&#160;&#61;&#160;15<br />
I&#160;can&#160;store&#160;values&#160;in&#160;position&#160;&#91;3&#44;4&#93;</div>
<p>La función propuesta no es ni mucho menos perfecta. Tendría que hacerse más genérica, permitir redimensionar no dos sino N dimensiones, controlar mejor posibles errores y demás. Pero puede ser una primera aproximación para resolver situaciones de este tipo...</p>
<p>PD. También es posible utilizar el método Array.Copy en lugar de iterar por las dos dimensiones de la matriz, aunque en este caso lo he hecho así para que resulte más evidente el proceso.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/11/redim-preserve-para-cambiar-mas-de-una-dimension-en-net/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Correspondencia entre tipos de datos en MySQL, en VisualBasic.NET y en .NET Framework.</title>
		<link>http://www.albertmata.net/2008/11/correspondencia-entre-tipos-de-datos-en-mysql-en-visualbasicnet-y-en-net-framework/#utm_source=rss&amp;utm_medium=rss&amp;utm_campaign=correspondencia-entre-tipos-de-datos-en-mysql-en-visualbasicnet-y-en-net-framework</link>
		<comments>http://www.albertmata.net/2008/11/correspondencia-entre-tipos-de-datos-en-mysql-en-visualbasicnet-y-en-net-framework/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 05:35:45 +0000</pubDate>
		<dc:creator>Albert Mata</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[bigint]]></category>
		<category><![CDATA[byte]]></category>
		<category><![CDATA[framework]]></category>
		<category><![CDATA[int]]></category>
		<category><![CDATA[integer]]></category>
		<category><![CDATA[long]]></category>
		<category><![CDATA[mediumint]]></category>
		<category><![CDATA[short]]></category>
		<category><![CDATA[smallint]]></category>
		<category><![CDATA[tinyint]]></category>
		<category><![CDATA[tipos datos]]></category>
		<category><![CDATA[visual basic]]></category>

		<guid isPermaLink="false">http://www.albertmata.net/?p=139</guid>
		<description><![CDATA[Estos últimos días he estado liado programando una clase que tira intensamente de reflexión (me refiero a System.Reflection, no a que haya estado reflexionando intensamente, que también) para relacionar un objeto de una clase determinada (la que sea) con una tabla en la base de datos. Así, utilizando esa clase auxiliar podemos decirle que cargue [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.albertmata.net/public/uploads/2008/10/mysql_visualstudio.jpg" alt="" title="mysql_visualstudio" width="165" height="131" class="alignleft size-full wp-image-140" />Estos últimos días he estado liado programando una clase que tira intensamente de reflexión (me refiero a System.Reflection, no a que haya estado reflexionando intensamente, que también) para relacionar un objeto de una clase determinada (la que sea) con una tabla en la base de datos. Así, utilizando esa clase auxiliar podemos decirle que cargue un objeto a partir de un registro de una tabla o que lo guarde en ella. Y sirve para cualquier clase que tenga una tabla relacionada en la base de datos. Quizá otro día cuelgo esa clase... Pero el caso es que mientras lo desarrollaba he tenido algunos problemillas por no encajarme exactamente los tipos de datos que me devolvía MySQL y los que esperaba .NET, así que tras haber estado buscando cuáles son las equivalencias exactas, paso a exponer la tabla de correspondencias entre tipos de datos tanto en MySQL como en VisualBasic.NET como en el .NET Framework.</p>
<div class="code">&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;&#160;&#160;&#160;&#160;&#160;&#160;MYSQL&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;&#160;VB&#46;NET&#160;&#160;&#124;&#160;&#46;NET&#160;Framework&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;<br />
&#124;&#160;TINYINT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;SByte&#160;&#160;&#160;&#160;&#124;&#160;SByte&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;TINYINT&#160;UNSIGNED&#160;&#160;&#160;&#124;&#160;Byte&#160;&#160;&#160;&#160;&#160;&#124;&#160;Byte&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;SMALLINT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;Short&#160;&#160;&#160;&#160;&#124;&#160;Int16&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;SMALLINT&#160;UNSIGNED&#160;&#160;&#124;&#160;UShort&#160;&#160;&#160;&#124;&#160;UInt16&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;MEDIUMINT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;Integer&#160;&#160;&#124;&#160;Int32&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;MEDIUMINT&#160;UNSIGNED&#160;&#124;&#160;UInteger&#160;&#124;&#160;UInt32&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;INT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;Integer&#160;&#160;&#124;&#160;Int32&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;INT&#160;UNSIGNED&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;UInteger&#160;&#124;&#160;UInt32&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;BIGINT&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;&#160;Long&#160;&#160;&#160;&#160;&#160;&#124;&#160;Int64&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#124;&#160;BIGINT&#160;UNSIGNED&#160;&#160;&#160;&#160;&#124;&#160;ULong&#160;&#160;&#160;&#160;&#124;&#160;UInt64&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#124;<br />
&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#45;&#43;</div>
<p>Teniendo en cuenta estas relaciones, todo funciona a las mil maravillas... <img src='http://www.albertmata.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.albertmata.net/2008/11/correspondencia-entre-tipos-de-datos-en-mysql-en-visualbasicnet-y-en-net-framework/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
