<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Visual Basic .Net</title>
        <link>http://blogs.ugidotnet.org/pietrolibroblog/category/Visual Basic .Net.aspx</link>
        <description>Visual Basic .Net</description>
        <language>it-IT</language>
        <copyright>Pietro Libro</copyright>
        <managingEditor>pietro.libro@libero.it</managingEditor>
        <generator>Subtext Version 2.6.0.0</generator>
        <item>
            <title>Documentazione EF 7 (Beta 5)</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2015/07/22/documentazione-ef-7-beta-5.aspx</link>
            <description>Documentazione "Work in Progress" della prossima release di Entity Framework : &lt;a href="http://ef.readthedocs.org/en/latest/" target="_blank"&gt;http://ef.readthedocs.org/en/latest/&lt;/a&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/102030.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2015/07/22/documentazione-ef-7-beta-5.aspx</guid>
            <pubDate>Wed, 22 Jul 2015 09:07:28 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2015/07/22/documentazione-ef-7-beta-5.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/102030.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/102030.aspx</trackback:ping>
        </item>
        <item>
            <title>Entity Framework 4 :POCO, Complex Type e Stored Procedure</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2011/01/12/entity-framework-4-poco-complex-type-e-stored-procedure.aspx</link>
            <description>&lt;p&gt;Nuovo articolo della serie pubblicato su &lt;a href="http://www.domusdotnet.org/articoli/entity-framework-40---supporto-poco-e-complex-type.aspx" target="_blank"&gt;DomusDotNet&lt;/a&gt;, comprensivo di sorgenti in C# e VB.NET. Al solito, critiche e suggerimenti sono sempre ben accetti.&lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99620.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2011/01/12/entity-framework-4-poco-complex-type-e-stored-procedure.aspx</guid>
            <pubDate>Wed, 12 Jan 2011 10:59:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2011/01/12/entity-framework-4-poco-complex-type-e-stored-procedure.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99620.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99620.aspx</trackback:ping>
        </item>
        <item>
            <title>Tappa Romana del Microsoft Community Tour 2010</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/15/tappa-romana-del-microsoft-community-tour-2010.aspx</link>
            <description>&lt;p&gt;Qualche foto della tappa Romana del Microsoft Community Tour, &lt;a href="http://www.domusdotnet.org/default.aspx" target="_blank"&gt;DomusDotNet&lt;/a&gt; e &lt;a href="http://www.visual-basic.it/" target="_blank"&gt;Visual Basic Tip &amp;amp; Tricks:&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;In ordine da sinistra verso destra:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Foto di gruppo dopo la sessione “Async CTP: async and iterator methods” for VB tenuta da Lucian Wischik (VB Spec Lead - Microsoft Corporation) . Sessione fantastica, ricca di spunti per il futuro, ma non solo. (nella foto Alessandro del Sole, Diego Cattaruzza, Nicolò Carandini e Lucian Wischik )&lt;/li&gt;    &lt;li&gt;Massimo, Speaker di &lt;a href="http://www.domusdotnet.org" target="_blank"&gt;DomusDotNet&lt;/a&gt; per la sessione “&lt;em&gt;IE9 &amp;amp; HTML5 for developers” &lt;/em&gt;&lt;/li&gt;    &lt;li&gt;Una foto della sessione “&lt;em&gt;IE9 &amp;amp; HTML5 for developers” &lt;/em&gt;&lt;/li&gt;    &lt;li&gt;A cena con Lucian :-) &lt;/li&gt;    &lt;li&gt;Giorgio, Speaker di DomusDotNet per la sessione &lt;em&gt;“ASP.NET MVC e il view engine Razor”&lt;/em&gt;&lt;/li&gt;    &lt;li&gt;Polo Windows Phone con il mio nome :-) (Grazie &lt;a href="http://www.geniodelmale.info/" target="_blank"&gt;Lorenzo&lt;/a&gt;)&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;  &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000020_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000020" border="0" alt="WP_000020" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000020_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000025%20-%20Copia_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000025 - Copia" border="0" alt="WP_000025 - Copia" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000025%20-%20Copia_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000023_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000023" border="0" alt="WP_000023" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000023_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000028_4.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000028" border="0" alt="WP_000028" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000028_thumb_1.jpg" width="244" height="184" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000027_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000027" border="0" alt="WP_000027" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000027_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt; &lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000029_2.jpg"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="WP_000029" border="0" alt="WP_000029" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/TappaRomanadelMicrosoftCommunityTour2010_C71C/WP_000029_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p /&gt;  &lt;p&gt;Purtroppo sono arrivato solo nel primo pomeriggio e di conseguenza non ho foto relative alle sessioni del mattino :-(. &lt;/p&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99482.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/15/tappa-romana-del-microsoft-community-tour-2010.aspx</guid>
            <pubDate>Mon, 15 Nov 2010 15:07:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/15/tappa-romana-del-microsoft-community-tour-2010.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99482.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99482.aspx</trackback:ping>
        </item>
        <item>
            <title>Introduzione a WCF 4, Hosting dei servizi</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/03/introduzione-a-wcf-4.0-hosting-dei-servizi.aspx</link>
            <description>Pubblicato sul portale di DomusDotNet l'ultima parte degli articoli introduttiva alla tecnologia WCF 4. L'argomento trattato è l'hosting dei servizi. Articolo e sorgenti (in C# e VB.NET) sono  disponibili &lt;a href="http://www.domusdotnet.org/articoli/introduzione-a-wcf-40---hosting-dei-servizi.aspx"&gt;qui&lt;/a&gt; . Al solito, critiche e suggerimenti sono sempre ben accetti.&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99429.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/03/introduzione-a-wcf-4.0-hosting-dei-servizi.aspx</guid>
            <pubDate>Wed, 03 Nov 2010 08:23:26 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/11/03/introduzione-a-wcf-4.0-hosting-dei-servizi.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99429.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99429.aspx</trackback:ping>
        </item>
        <item>
            <title>Introduzione a WCF 4, Error Handling</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/27/introduzione-a-wcf-4.0-error-handling.aspx</link>
            <description>Pubblicato sul portale di DomusDotNet la terza parte della serie  introduttiva su WCF 4. L'argomento trattato è la gestione degli errori. Articolo e sorgenti (in C# e VB.NET) sono  disponibili &lt;a href="http://www.domusdotnet.org/articoli/introduzione-a-wcf-40---terza-parte.aspx"&gt;qui&lt;/a&gt; . Critiche e suggerimenti sono sempre ben accetti.&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99404.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/27/introduzione-a-wcf-4.0-error-handling.aspx</guid>
            <pubDate>Wed, 27 Oct 2010 10:14:37 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/27/introduzione-a-wcf-4.0-error-handling.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99404.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99404.aspx</trackback:ping>
        </item>
        <item>
            <title>Introduzione a WCF 4, Seconda parte</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/20/introduzione-a-wcf-4-seconda-parte.aspx</link>
            <description>Pubblicato sul portale di DomusDotNet la seconda parte della mini serie introduttiva su WCF 4. Articolo e sorgenti (in C# e VB.NET) sono disponibili &lt;a href="http://www.domusdotnet.org/articoli/introduzione-a-wcf-40---seconda-parte.aspx"&gt;qui&lt;/a&gt;. Al solito, critiche e suggerimenti sono sempre ben accetti.&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99371.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/20/introduzione-a-wcf-4-seconda-parte.aspx</guid>
            <pubDate>Wed, 20 Oct 2010 09:56:27 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/20/introduzione-a-wcf-4-seconda-parte.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99371.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99371.aspx</trackback:ping>
        </item>
        <item>
            <title>Introduzione a WCF 4</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/13/introduzione-a-wcf-4.aspx</link>
            <description>E' uscito il primo di una mini-serie di articoli riguardanti la nuova versione di WCF. Per chi fosse interessato potete trovare l'articolo su DomuDotNet: &lt;span style="text-decoration: underline;"&gt;&lt;a href="http://www.domusdotnet.org/articoli/introduzione-a-wcf-40---prima-parte.aspx"&gt;Introduzione a WCF 4 .&lt;/a&gt;&lt;/span&gt; Lo scopo della serie è partire dalle basi e affrontare successivamente tematiche più avanzate. Al solito, critiche e suggerimenti sono sempre ben accetti.  La prossima settimana la seconda puntata.&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/99345.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/13/introduzione-a-wcf-4.aspx</guid>
            <pubDate>Wed, 13 Oct 2010 11:32:29 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2010/10/13/introduzione-a-wcf-4.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/99345.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/99345.aspx</trackback:ping>
        </item>
        <item>
            <title>RegexStringValidator</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/09/17/94060.aspx</link>
            <description>&lt;p&gt;Con la versione 2.0 del .Net Framework è stata aggiunta al namespace &lt;em&gt;System.Configuration&lt;/em&gt;, la classe &lt;em&gt;RegexStringValidator&lt;/em&gt; che permette di eseguire rapidatamente la validazione di stringhe utilizzando espressioni regolari. Supponendo di avere un'espressione del tipo &lt;em&gt;^\d+,\d{2}$&lt;/em&gt;, che permette di verificare se una stringa rappresenta un valore numerico con due cifre dopo la virgola, per validare una stringa, possiamo scrivere una funzione molto semplice:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:4c218f6d-ddec-48e3-953f-e564248760df" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080;"&gt; 1&lt;/span&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Function&lt;/span&gt;&lt;span style="color: #000000;"&gt; IsValid(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;ByVal&lt;/span&gt;&lt;span style="color: #000000;"&gt; value &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;String&lt;/span&gt;&lt;span style="color: #000000;"&gt;) &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Boolean&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 2&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 3&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; regexValidator &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&lt;span style="color: #000000;"&gt; RegexStringValidator(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;^\d+,\d{2}$&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;)
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 4&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 5&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Try&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 6&lt;/span&gt; &lt;span style="color: #000000;"&gt;            regexValidator.Validate(value)
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 7&lt;/span&gt; &lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Return&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;True&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 8&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Catch&lt;/span&gt;&lt;span style="color: #000000;"&gt; ex &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; ArgumentException
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 9&lt;/span&gt; &lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;E'possibile sfruttuare l'istanza di ArgumentException per &lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;10&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;ottenere maggiori informazioni sull'eccezione&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;11&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Return&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;False&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;12&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Try&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;13&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;14&lt;/span&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End Function&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;Utilizzando il metodo &lt;em&gt;classico&lt;/em&gt;, avremmo potuto scrivere:&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:ab2ebcbf-4a5c-42f9-8419-467fc03b0340" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080;"&gt;1&lt;/span&gt; &lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; regex &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;New&lt;/span&gt;&lt;span style="color: #000000;"&gt; System.Text.RegularExpressions.Regex(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;^\d+,\d{2}$&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;2&lt;/span&gt; &lt;span style="color: #000000;"&gt;&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Dim&lt;/span&gt;&lt;span style="color: #000000;"&gt; match &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; System.Text.RegularExpressions.Match &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; regex.Match(&lt;/span&gt;&lt;span style="color: #800000;"&gt;""&lt;/span&gt;&lt;span style="color: #000000;"&gt;)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;3&lt;/span&gt; &lt;span style="color: #000000;"&gt;MessageBox.Show(match.Success)&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;

&lt;p&gt;Un'osservazione: Per verificare che un oggetto possa essere validato utilizzando &lt;em&gt;RegexStringValidator&lt;/em&gt;, è sufficiente utilizzare il metodo d'istanza &lt;em&gt;CanValidate&lt;/em&gt; della classe.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e179058c-e18c-4f0b-9053-505394596bfa" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tag: &lt;a href="http://technorati.com/tags/RegexStringValidator" rel="tag"&gt;RegexStringValidator&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/94060.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/09/17/94060.aspx</guid>
            <pubDate>Wed, 17 Sep 2008 11:00:58 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/09/17/94060.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/94060.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/94060.aspx</trackback:ping>
        </item>
        <item>
            <title>DataTable.RowChanged e ProgressBar</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/13/91175.aspx</link>
            <description>&lt;p&gt;Se abbiamo bisogno di una soluzione veloce per visualizzare l'avanzamento di un controllo ProgressBar durante il caricamento di un DataTable, possiamo gestire l'evento &lt;em&gt;RowChanded &lt;/em&gt;in questo modo:&lt;/p&gt;  &lt;p&gt;   &lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:9e283011-ed26-4b51-b6bf-77d44ef58e08" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080;"&gt;1&lt;/span&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Private&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Sub&lt;/span&gt;&lt;span style="color: #000000;"&gt; CustomRowChanged(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;ByVal&lt;/span&gt;&lt;span style="color: #000000;"&gt; sender &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Object&lt;/span&gt;&lt;span style="color: #000000;"&gt;, &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;ByVal&lt;/span&gt;&lt;span style="color: #000000;"&gt; e &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; DataRowChangeEventArgs)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;2&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;3&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;If&lt;/span&gt;&lt;span style="color: #000000;"&gt; (e.Action &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; DataRowAction.Commit) &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Then&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;4&lt;/span&gt; &lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Avanziamo il valore della progress bar&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;5&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;            ProgressBar1.Value &lt;/span&gt;&lt;span style="color: #000000;"&gt;+=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;1&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;6&lt;/span&gt; &lt;span style="color: #000000;"&gt;            Application.DoEvents()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;7&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;If&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;8&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;9&lt;/span&gt; &lt;span style="color: #000000;"&gt;    &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;


&lt;p&gt;Il codice per popolare il DataTable con i dati e per registrare il gestore eventi personalizzato può essere del tipo:&lt;/p&gt;

&lt;p&gt;
  &lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:5e7d92c5-8f36-45f4-a4fe-a214e87f0e15" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;pre style="background-color:White;white-space:-moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; white-space: pre-wrap; word-wrap: break-word;;overflow: auto;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008080;"&gt; 1&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Imposto la proprietà Maximux del controllo ProgressBar&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 2&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;        ProgressBar1.Value &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #800080;"&gt;0&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 3&lt;/span&gt; &lt;span style="color: #000000;"&gt;        ProgressBar1.Maximum &lt;/span&gt;&lt;span style="color: #000000;"&gt;=&lt;/span&gt;&lt;span style="color: #000000;"&gt; GetNumeroRecords()
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 4&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 5&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Registro il gestore eventi personalizzato&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 6&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;AddHandler&lt;/span&gt;&lt;span style="color: #000000;"&gt; Articoli.ArticoliDataTable.RowChanged, &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;AddressOf&lt;/span&gt;&lt;span style="color: #000000;"&gt; CustomRowChanged
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 7&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 8&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Try&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt; 9&lt;/span&gt; &lt;span style="color: #000000;"&gt;            DataGridView1.SuspendLayout()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;10&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;11&lt;/span&gt; &lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Popolo il DataTable &lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;12&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;            ArticoliTableAdapter.Fill(Articoli.ArticoliDataTable)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;13&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;14&lt;/span&gt; &lt;span style="color: #000000;"&gt;            MessageBox.Show(&lt;/span&gt;&lt;span style="color: #0000FF;"&gt;String&lt;/span&gt;&lt;span style="color: #000000;"&gt;.Format(&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #800000;"&gt;Caricati {0} records&lt;/span&gt;&lt;span style="color: #800000;"&gt;"&lt;/span&gt;&lt;span style="color: #000000;"&gt;,Articoli.ArticoliDataTable.Rows.Count))
&lt;/span&gt;&lt;span style="color: #008080;"&gt;15&lt;/span&gt; &lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;16&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Catch&lt;/span&gt;&lt;span style="color: #000000;"&gt; ex &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;As&lt;/span&gt;&lt;span style="color: #000000;"&gt; Exception
&lt;/span&gt;&lt;span style="color: #008080;"&gt;17&lt;/span&gt; &lt;span style="color: #000000;"&gt;            MessageBox.Show(ex.Message)
&lt;/span&gt;&lt;span style="color: #008080;"&gt;18&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Finally&lt;/span&gt;&lt;span style="color: #000000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;19&lt;/span&gt; &lt;span style="color: #000000;"&gt;            DataGridView1.ResumeLayout()
&lt;/span&gt;&lt;span style="color: #008080;"&gt;20&lt;/span&gt; &lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #008000;"&gt;'&lt;/span&gt;&lt;span style="color: #008000;"&gt;Rimuovo l'handler...&lt;/span&gt;&lt;span style="color: #008000;"&gt;
&lt;/span&gt;&lt;span style="color: #008080;"&gt;21&lt;/span&gt; &lt;span style="color: #008000;"&gt;&lt;/span&gt;&lt;span style="color: #000000;"&gt;            &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;RemoveHandler&lt;/span&gt;&lt;span style="color: #000000;"&gt; Articoli.ArticoliDataTable.RowChanged, &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;AddressOf&lt;/span&gt;&lt;span style="color: #000000;"&gt; CustomRowChanged
&lt;/span&gt;&lt;span style="color: #008080;"&gt;22&lt;/span&gt; &lt;span style="color: #000000;"&gt;        &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;End&lt;/span&gt;&lt;span style="color: #000000;"&gt; &lt;/span&gt;&lt;span style="color: #0000FF;"&gt;Try&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;


&lt;p&gt;Ovviamente si potrebbero usare modelli di programmazione asincrona o popolare dati mediante un thread diverso da quello principale.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:e48dcc0f-320d-4a32-b7b4-7c230f0136da" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;Technorati Tag: &lt;a href="http://technorati.com/tags/DataTable.RowChanged%20Event" rel="tag"&gt;DataTable.RowChanged Event&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/91175.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/13/91175.aspx</guid>
            <pubDate>Wed, 13 Feb 2008 18:00:29 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/13/91175.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/91175.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/91175.aspx</trackback:ping>
        </item>
        <item>
            <title>Windows Form, thread ed eccezioni</title>
            <link>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/03/90987.aspx</link>
            <description>&lt;p&gt;Supponiamo di avere una semplice applicazione Windows Form il cui unico (e stupido) compito è quello di eseguire una divisione, qualcosa  del tipo&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/WindowsFormthreadedeccezioni_A6FC/Img_1.jpg"&gt;&lt;img width="151" height="134" border="0" style="border-width: 0px;" alt="Img_1" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/WindowsFormthreadedeccezioni_A6FC/Img_1_thumb.jpg" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p align="justify"&gt;Se non eseguiamo nessuna validazione sui campi, potrebbe accadere che vengano eseguiti calcoli sbagliati (ad esempio una divisione per zero)  e di conseguenza che vengano sollevate le corrispondenti eccezioni. Per catturarle, possiamo utilizzare dei blocchi&lt;em&gt; Try...Catch...Finally&lt;/em&gt; oppure  gestire l'evento &lt;em&gt;Application.ThreadException&lt;/em&gt;. Così facendo, oltre alla possibilità di memorizzare un log delle eccezioni a livello di applicazione o eseguire del codice di pulizia, possiamo visualizzare una Windows Form &lt;em&gt;User-Friendly&lt;/em&gt;, senza interrompere bruscamente l'applicazione. Per registrare il gestore  dell'evento &lt;em&gt;ThreadException&lt;/em&gt;, possiamo aggiungere un modulo al nostro progetto e scrivere il seguente codice:&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:e1f4ff5a-a087-4220-8d31-98407612362d" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;
&lt;pre style="overflow: auto; background-color: White; white-space: -moz-pre-wrap;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 1&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;STAThread()&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; _&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 2&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Sub&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Main()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 3&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 4&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Imposta il gestore evento Application.ThreadExeception personalizzato&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 5&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddHandler&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Application.ThreadException, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddressOf&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; CustomErrorHandler&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 6&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 7&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddHandler&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; AppDomain.CurrentDomain.UnhandledException, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddressOf&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; AppDomainCustomErrorHandler&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 8&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 9&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Imposta il gestore evento Application.ApplicationExit personalizzato&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;10&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddHandler&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Application.ApplicationExit, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;AddressOf&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; CustomApplicationExit&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;11&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;12&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        Application.Run(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;New&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Form1())&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;13&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt;Dove il gestore &lt;em&gt;CustomErrorHandler&lt;/em&gt; è del tipo:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:12c908bb-edbd-4359-b302-fdcae477c2b8" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;
&lt;pre style="overflow: auto; background-color: White; white-space: -moz-pre-wrap;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 1&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Sub&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; CustomErrorHandler(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;ByVal&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sender &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Object&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;ByVal&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; System.Threading.ThreadExceptionEventArgs)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 2&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 3&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 4&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Gestisce l'eccezione visualizzando una finestra di dialogo comune per l'eventuali eccezioni&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 5&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            My.Forms.frmExeception.DescrizioneEccezione &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e.Exception.Message&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 6&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            My.Forms.frmExeception.ShowDialog()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 7&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ex &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Exception&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 8&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 9&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;10&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;11&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Il quale, in caso di eccezione, visualizza la seguente finestra di dialogo:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/WindowsFormthreadedeccezioni_A6FC/Img_2.jpg"&gt;&lt;img width="244" height="126" border="0" style="border-width: 0px;" alt="Img_2" src="http://blogs.ugidotnet.org/images/blogs_ugidotnet_org/PietroLibroBlog/WindowsLiveWriter/WindowsFormthreadedeccezioni_A6FC/Img_2_thumb.jpg" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p align="justify"&gt;Nel &lt;em&gt;Sub Main&lt;/em&gt;, oltre a registrare l'evento &lt;em&gt;Application.ThreadException&lt;/em&gt;, viene registrato anche il gestore per l'evento &lt;em&gt;AppDomain.CurrentDomain.UnhandledExecption&lt;/em&gt;, perchè nel in cui caso la nostra applicazione sfrutti il multithreading, l'eventuali eccezioni dovute ai thread secondari non sarebbero catturate da &lt;em&gt;CustomErrorHandler&lt;/em&gt;. Il codice del gestore per l'evento &lt;em&gt;AppDomain.CurrrentDomain.UnhandledException&lt;/em&gt; è il seguente:&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:57F11A72-B0E5-49c7-9094-E3A15BD5B5E6:3ece1029-72c0-4862-b3be-676dd3892d85" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;
&lt;pre style="overflow: auto; background-color: White; white-space: -moz-pre-wrap;"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 1&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;Public&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Sub&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; AppDomainCustomErrorHandler(&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;ByVal&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; sender &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Object&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;ByVal&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; e &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; UnhandledExceptionEventArgs)&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 2&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 3&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Gestisce l'eccezione visualizzando una finestra di dialogo comune per l'eventuali eccezioni&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 4&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Ottiene l'oggetto Exception&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 5&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Dim&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; appDomainException &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Exception &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;DirectCast&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;(e.ExceptionObject, System.Exception)            &lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 6&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            My.Forms.frmExeception.DescrizioneEccezione &lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; appDomainException.Message&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 7&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            My.Forms.frmExeception.ShowDialog()&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 8&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt; 9&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;If&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; (e.IsTerminating) &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Then&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;10&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;                &lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;'&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;Operazioni di pulizia...&lt;/span&gt;&lt;span style="color: rgb(0, 128, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;11&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;            &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;If&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;12&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Catch&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; ex &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;As&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; Exception&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;13&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;14&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;        &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;Try&lt;/span&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color: rgb(0, 128, 128);"&gt;15&lt;/span&gt; &lt;span style="color: rgb(0, 0, 0);"&gt;    &lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;End Sub&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;p align="justify"&gt;Il quale esegue una cast dell'oggetto&lt;em&gt; e.ExceptionObject&lt;/em&gt; in &lt;em&gt;System.Exception&lt;/em&gt; e visualizza la finestra di dialogo su mostrata. L'istanza di oggetto &lt;em&gt;UnhandledExecptionEventArgs&lt;/em&gt; espone la proprietà &lt;em&gt;IsTerminating&lt;/em&gt; che indica se il common language runtime stà terminando o meno. Nel caso di &lt;em&gt;UnhandledExecption&lt;/em&gt;, il .Net Framework , con o senza gestione del relativo evento, visualizza la classica finestra di dialogo per l'esecuzione del debug  dell'applicazione. Per testare il codice ed il relativo comportamento dell'applicazione, da Visual Studio è necessario lanciare l'applicazione  senza Debug.&lt;/p&gt;
&lt;a title="Codice Sorgente Esempio" target="_blank" href="http://www.pietrolibro.name/sources/Thread Exception.zip"&gt;Thread Exception.zip&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;div class="wlWriterSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:8edd1700-5b3f-4701-99dd-4216c586dd78" style="margin: 0px; padding: 0px; display: inline; float: none;"&gt;Technorati Tag: &lt;a href="http://technorati.com/tags/Application.ThreadException" rel="tag"&gt;Application.ThreadException&lt;/a&gt;,&lt;a href="http://technorati.com/tags/UnhandledException" rel="tag"&gt;UnhandledException&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blogs.ugidotnet.org/pietrolibroblog/aggbug/90987.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Pietro Libro</dc:creator>
            <guid>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/03/90987.aspx</guid>
            <pubDate>Sun, 03 Feb 2008 13:26:00 GMT</pubDate>
            <comments>http://blogs.ugidotnet.org/pietrolibroblog/archive/2008/02/03/90987.aspx#feedback</comments>
            <wfw:commentRss>http://blogs.ugidotnet.org/pietrolibroblog/comments/commentRss/90987.aspx</wfw:commentRss>
            <trackback:ping>http://blogs.ugidotnet.org/pietrolibroblog/services/trackbacks/90987.aspx</trackback:ping>
        </item>
    </channel>
</rss>