<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>C# &#8211; MaxVergelli.com</title>
	<atom:link href="https://www.maxvergelli.com/category/programming/c/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.maxvergelli.com</link>
	<description>sourcecode repository</description>
	<lastBuildDate>Fri, 17 Apr 2020 18:23:39 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2020/04/wp-1586823685141.png?fit=32%2C32&#038;ssl=1</url>
	<title>C# &#8211; MaxVergelli.com</title>
	<link>https://www.maxvergelli.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">34603511</site>	<item>
		<title>Create an Excel file in C# without Microsoft Office or Third party plugins</title>
		<link>https://www.maxvergelli.com/create-an-excel-file-in-c-without-microsoft-office-or-third-party-plugins/</link>
					<comments>https://www.maxvergelli.com/create-an-excel-file-in-c-without-microsoft-office-or-third-party-plugins/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sat, 18 Apr 2020 18:07:00 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[.net-framework]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dll]]></category>
		<category><![CDATA[epplus5]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[excel-cell]]></category>
		<category><![CDATA[excel-document]]></category>
		<category><![CDATA[excel-row]]></category>
		<category><![CDATA[excel-sheet]]></category>
		<category><![CDATA[excel-workbook]]></category>
		<category><![CDATA[excellibrary]]></category>
		<category><![CDATA[free-dll]]></category>
		<category><![CDATA[free-library]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[libre-office]]></category>
		<category><![CDATA[microsoft-excel]]></category>
		<category><![CDATA[microsoft-office]]></category>
		<category><![CDATA[office]]></category>
		<category><![CDATA[open-source]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[workbook]]></category>
		<category><![CDATA[xls]]></category>
		<category><![CDATA[xlsx]]></category>
		<guid isPermaLink="false">https://www.maxvergelli.com/?p=247</guid>

					<description><![CDATA[How to create an Excel file (XLS / XLSX) in C# without having a copy of Microsoft Office on the server, or other third party plugins installed]]></description>
										<content:encoded><![CDATA[
<p>What I&#8217;m about to say seems paradoxical, but the reality is that in open environments (as in PHP for example) it is often easier and we have less problems in creating or converting files in proprietary systems, compared to what happens on frameworks such as Microsoft&#8217;s .Net; this is the case when we have to create an Excel file (XLS / XLSX) in C# without having a copy of Microsoft Office on the server, or other third party plugins installed, without the right libraries in our project we will have several headaches. A quick solution is to use the open-source library <a href="https://github.com/gustafl/ExcelLibrary" class="aioseop-link">ExcelLibrary</a>. This looks to be a port of the PHP ExcelWriter, it&#8217;s very simple, small and easy to use.</p>



<p><strong>Using ExcelLibrary</strong></p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;clike&quot;,&quot;mime&quot;:&quot;text/x-csharp&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;language&quot;:&quot;C#&quot;,&quot;modeName&quot;:&quot;csharp&quot;}">Workbook workbook = new Workbook();
workbook.Open(&quot;Book1.xlsx&quot;);
Sheet sheet = workbook.Sheet(&quot;Sheet1&quot;);
Row row = sheet.Row(2);
Cell cell = row.Cell(3);
string text = cell.Value;</pre></div>



<p><strong>Main features</strong></p>



<ul><li>No dependencies except .NET Framework 4.5. Easy to include in other solutions.</li><li>Built and extendable with LINQ. Most collections in the library (e.g. <code>Workbook.Sheets</code> or <code>Row.Cells</code>) is of type <code>IEnumerable&lt;T&gt;</code>, which allows you to use LINQ queries to find exactly what you need.</li><li>Respects the visibility of sheets, rows and columns. Set the <code>IncludeHidden</code> option to <code>true</code>to return hidden objects.</li><li>Well-tested. The library is being developed using principles of Test-driven development (TDD). A large set of unit tests verifies that new bugs are not introduced on code changes.</li><li>Well-documented. A software library is only as useful as its documentation.</li></ul>



<p>Another valid alternative is <a href="https://github.com/EPPlusSoftware/EPPlus" class="aioseop-link">EPPLUS5</a>  however it has a new license model from version 5, it&#8217;s still free to use in some cases, but will require a commercial license to be used in a commercial business.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/create-an-excel-file-in-c-without-microsoft-office-or-third-party-plugins/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">247</post-id>	</item>
		<item>
		<title>C# code to VB.NET free online converter</title>
		<link>https://www.maxvergelli.com/c-sharp-code-to-vb-net-free-online-converter/</link>
					<comments>https://www.maxvergelli.com/c-sharp-code-to-vb-net-free-online-converter/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sun, 01 Mar 2020 16:31:43 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=86</guid>

					<description><![CDATA[Simply paste your C# code and this free online utility will automatically convert it to its equivalent in VB.NET. This utility now support .NET 3.5 syntax: http://www.developerfusion.com/tools/convert/csharp-to-vb/ You can reverse code from VB.NET to C# too. 🙂]]></description>
										<content:encoded><![CDATA[<p>Simply paste your C# code and this free online utility will automatically convert it to its equivalent in VB.NET. This utility now support .NET 3.5 syntax:</p>
<p><a href="http://www.developerfusion.com/tools/convert/csharp-to-vb/">http://www.developerfusion.com/tools/convert/csharp-to-vb/</a></p>
<p>You can reverse code from VB.NET to C# too.</p>
<p>🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/c-sharp-code-to-vb-net-free-online-converter/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">86</post-id>	</item>
		<item>
		<title>New Associative Array Class for VB.NET / ASP.NET and C#</title>
		<link>https://www.maxvergelli.com/new-associative-array-class-for-vb-net-asp-net-and-c-sharp/</link>
					<comments>https://www.maxvergelli.com/new-associative-array-class-for-vb-net-asp-net-and-c-sharp/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 26 Feb 2020 16:30:19 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=84</guid>

					<description><![CDATA[I have coded the  &#8220;Associative Array Class&#8221; also for VB.NET and ASP.NET so You can add this class to your .NET projects; Download the VB.NET/ASP.NET Associative Array Class from: https://sourceforge.net/projects/vbnetassocarray/ You will find a tutorial inside the archive.]]></description>
										<content:encoded><![CDATA[<p>I have coded the  &#8220;Associative Array Class&#8221; also for VB.NET and ASP.NET so You can add this class to your .NET projects;</p>
<p>Download the VB.NET/ASP.NET Associative Array Class from:</p>
<p><a href="https://sourceforge.net/projects/vbnetassocarray/">https://sourceforge.net/projects/vbnetassocarray/</a></p>
<p>You will find a tutorial inside the archive.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/new-associative-array-class-for-vb-net-asp-net-and-c-sharp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">84</post-id>	</item>
		<item>
		<title>vb.net Bitmap object locks images (impossible to move/delete jpg/gif files) &#8211; .Dispose() Method common problem</title>
		<link>https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/</link>
					<comments>https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Tue, 14 Jan 2020 15:47:04 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[dispose]]></category>
		<category><![CDATA[file]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[object]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[vb.net]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=74</guid>

					<description><![CDATA[Many people are in trouble and on forums asking why the .Net Bitmap object does not release an image with its .Dispose() method. The Bitmap object (after its destruction too) seems to lock the image file, then we are not &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/" aria-label="vb.net Bitmap object locks images (impossible to move/delete jpg/gif files) &#8211; .Dispose() Method common problem">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>Many people are in trouble and on forums asking why the .Net Bitmap object does not release an image with its .Dispose() method. The Bitmap object (after its destruction too) seems to lock the image file, then we are not able to move or delete that image file through the file system.</p>
<p>This is a known problem and it occurs when we declare and instantiate a Bitmap object and destruct that like in the following code:</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>                &#8216;create a bitmap object<br />
                Dim myBitmap As New Bitmap(&quot;c:myimage.jpg&quot;)</p>
<p>                &#8216;editing image routines, right here<br />
                &#8216;&#8230;</p>
<p>                &#8216;release all Bitmap object resources<br />
                myBitmap.Dispose()</p>
<p>[/sourcecode]</p>
<p>The above code it is formally correct, however in same circumstances the .net garbage collector cannot recognize bitmap&#8217;s disposing; Dispose() method leaves the image file in an unusable state, then as <a href="http://msdn.microsoft.com/en-us/library/8th8381z.aspx">MSDN</a> said, we MUST release explicitly any reference after a Dispose() call;</p>
<p>with the following code, You will not encounter any problem, and after Dispose() You can edit, move, delete the image file by the filesystem functions&#8230;</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
                &#8216;create a bitmap object<br />
                Dim myBitmap As New Bitmap(&quot;c:myimage.jpg&quot;)</p>
<p>                &#8216;editing image routines, right here<br />
                &#8216;&#8230;</p>
<p>                &#8216;release image reference<br />
                While myBitmap IsNot Nothing<br />
                    myBitmap.Dispose()<br />
                    myBitmap = Nothing  &#8216;&lt;&#8211; tells .net garbage collector to release resources<br />
                End While</p>
<p>[/sourcecode]</p>
<p>Happy image editing! 🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">74</post-id>	</item>
		<item>
		<title>How to draw a shadow for a bitmap (Drop Shadow Effect in VB.NET / ASP.NET)</title>
		<link>https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/</link>
					<comments>https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Thu, 09 Jan 2020 15:41:16 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[backcolor]]></category>
		<category><![CDATA[background-color]]></category>
		<category><![CDATA[bitamp-library]]></category>
		<category><![CDATA[bitmap]]></category>
		<category><![CDATA[bitmap-effect]]></category>
		<category><![CDATA[bitmap-fx]]></category>
		<category><![CDATA[bitmap-manipulation]]></category>
		<category><![CDATA[bitmap-processing]]></category>
		<category><![CDATA[bitmap-programming]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[color]]></category>
		<category><![CDATA[digital-image-processing]]></category>
		<category><![CDATA[draw]]></category>
		<category><![CDATA[draw-bitmap]]></category>
		<category><![CDATA[drawing]]></category>
		<category><![CDATA[drop-shadow]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[fx]]></category>
		<category><![CDATA[graphic-manipulation]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[image-filter]]></category>
		<category><![CDATA[image-fx]]></category>
		<category><![CDATA[image-height]]></category>
		<category><![CDATA[image-library]]></category>
		<category><![CDATA[image-manipulation]]></category>
		<category><![CDATA[image-manipulation-algorithm]]></category>
		<category><![CDATA[image-matrix]]></category>
		<category><![CDATA[image-processing]]></category>
		<category><![CDATA[image-processing-algorithm]]></category>
		<category><![CDATA[image-width]]></category>
		<category><![CDATA[library]]></category>
		<category><![CDATA[matrix-manipulation]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[opacity]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[shadow]]></category>
		<category><![CDATA[shadow-effect]]></category>
		<category><![CDATA[thread-safe]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=72</guid>

					<description><![CDATA[I wrote a vb.net subroutine to draw easly a shadow for a Bitmap object; It is possible get a charming shadow in different ways&#8230; Normal black shadow to the bottom right corner Red shadow to the bottom right corner Shadow &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/" aria-label="How to draw a shadow for a bitmap (Drop Shadow Effect in VB.NET / ASP.NET)">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>I wrote a vb.net subroutine to draw easly a shadow for a Bitmap object; It is possible get a charming shadow in different ways&#8230;</p>
<table>
<tbody>
<tr>
<td>Normal black shadow to the bottom right corner</td>
<td><img src="https://i1.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_01_black_to_white.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Red shadow to the bottom right corner</td>
<td><img src="https://i1.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_02_red_to_white.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow to the bottom left corner</td>
<td><img src="https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_04_d_bottomleft.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow to the top left corner</td>
<td><img src="https://i0.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_05_d_topleft.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow to the top right corner</td>
<td><img src="https://i0.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_06_d_topright.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow with Opacity: &#8220;128&#8221;</td>
<td><img src="https://i2.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_07_opacity.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow with Opacity: &#8220;128&#8221; and Softness: &#8220;8&#8221;</td>
<td><img src="https://i1.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_08_opacityandsoftness.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow with Opacity: &#8220;128&#8221;, Softness: &#8220;8&#8221; and Distance: &#8220;10&#8221;</td>
<td><img src="https://i1.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_09_opacitysoftnessanddistance.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
<tr>
<td>Shadow without rounded edges</td>
<td><img src="https://i0.wp.com/www.maxvergelli.com/wp-content/uploads/2016/06/test_shadow_10_noroundededges.jpg?w=1140" data-recalc-dims="1" /></td>
</tr>
</tbody>
</table>
<p>Copy and paste my following vb.net code in your application. it does all the hard job&#8230;</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>    &#8216;ShadowDirection:<br />
    &#8216;       TOP_RIGHT = 1<br />
    &#8216;       BOTTOM_RIGHT = 2<br />
    &#8216;       BOTTOM_LEFT = 3<br />
    &#8216;       TOP_LEFT = 4<br />
    &#8216;ShadowOpacity: from 0 to 255<br />
    &#8216;ShadowSoftness: from 1 to 30<br />
    &#8216;ShadowDistance: from 1 to 50<br />
    &#8216;ShadowRoundedEdges: True or False</p>
<p>    &#8216;Note:<br />
    &#8216;If You set &quot;transparent&quot; as background color, this is replaced with white color.</p>
<p>    Public Enum ShadowDirections As Integer<br />
        TOP_RIGHT = 1<br />
        BOTTOM_RIGHT = 2<br />
        BOTTOM_LEFT = 3<br />
        TOP_LEFT = 4<br />
    End Enum</p>
<p>    &lt;STAThread()&gt; _<br />
    Public Sub DropShadow(ByRef SourceImage As Drawing.Bitmap, _<br />
                            ByVal ShadowColor As Drawing.Color, _<br />
                            ByVal BackgroundColor As Drawing.Color, _<br />
                            Optional ByVal ShadowDirection As ShadowDirections = _<br />
                                                  ShadowDirections.BOTTOM_RIGHT, _<br />
                            Optional ByVal ShadowOpacity As Integer = 190, _<br />
                            Optional ByVal ShadowSoftness As Integer = 4, _<br />
                            Optional ByVal ShadowDistance As Integer = 5, _<br />
                            Optional ByVal ShadowRoundedEdges As Boolean = True)<br />
        Dim ImgTarget As Bitmap = Nothing<br />
        Dim ImgShadow As Bitmap = Nothing<br />
        Dim g As Graphics = Nothing<br />
        Try<br />
            If SourceImage IsNot Nothing Then<br />
                If ShadowOpacity &lt; 0 Then<br />
                    ShadowOpacity = 0<br />
                ElseIf ShadowOpacity &gt; 255 Then<br />
                    ShadowOpacity = 255<br />
                End If<br />
                If ShadowSoftness &lt; 1 Then<br />
                    ShadowSoftness = 1<br />
                ElseIf ShadowSoftness &gt; 30 Then<br />
                    ShadowSoftness = 30<br />
                End If<br />
                If ShadowDistance &lt; 1 Then<br />
                    ShadowDistance = 1<br />
                ElseIf ShadowDistance &gt; 50 Then<br />
                    ShadowDistance = 50<br />
                End If<br />
                If ShadowColor = Color.Transparent Then<br />
                    ShadowColor = Color.Black<br />
                End If<br />
                If BackgroundColor = Color.Transparent Then<br />
                    BackgroundColor = Color.White<br />
                End If</p>
<p>                &#8216;get shadow<br />
                Dim shWidth As Integer = CInt(SourceImage.Width / ShadowSoftness)<br />
                Dim shHeight As Integer = CInt(SourceImage.Height / ShadowSoftness)<br />
                ImgShadow = New Bitmap(shWidth, shHeight)<br />
                g = Graphics.FromImage(ImgShadow)<br />
                g.Clear(Color.Transparent)<br />
                g.InterpolationMode = InterpolationMode.HighQualityBicubic<br />
                g.SmoothingMode = SmoothingMode.AntiAlias<br />
                Dim sre As Integer = 0<br />
                If ShadowRoundedEdges = True Then sre = 1<br />
                g.FillRectangle(New SolidBrush(Color.FromArgb(ShadowOpacity, ShadowColor)), _<br />
                                      sre, sre, shWidth, shHeight)<br />
                g.Dispose()</p>
<p>                &#8216;draw shadow<br />
                Dim d_shWidth As Integer = SourceImage.Width + ShadowDistance<br />
                Dim d_shHeight As Integer = SourceImage.Height + ShadowDistance<br />
                ImgTarget = New Bitmap(d_shWidth, d_shHeight)<br />
                g = Graphics.FromImage(ImgTarget)<br />
                g.Clear(BackgroundColor)<br />
                g.InterpolationMode = InterpolationMode.HighQualityBicubic<br />
                g.SmoothingMode = SmoothingMode.AntiAlias<br />
                g.DrawImage(ImgShadow, New Rectangle(0, 0, d_shWidth, d_shHeight), _<br />
                                        0, 0, ImgShadow.Width, ImgShadow.Height, GraphicsUnit.Pixel)<br />
                Select Case ShadowDirection<br />
                    Case ShadowDirections.BOTTOM_RIGHT<br />
                        g.DrawImage(SourceImage, _<br />
                            New Rectangle(0, 0, SourceImage.Width,SourceImage.Height), _<br />
                               0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)<br />
                    Case ShadowDirections.BOTTOM_LEFT<br />
                        g.Dispose()<br />
                        ImgTarget.RotateFlip(RotateFlipType.RotateNoneFlipX)<br />
                        g = Graphics.FromImage(ImgTarget)<br />
                        g.DrawImage(SourceImage, _<br />
                             New Rectangle(ShadowDistance, 0, SourceImage.Width, SourceImage.Height), _<br />
                                    0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)<br />
                    Case ShadowDirections.TOP_LEFT<br />
                        g.Dispose()<br />
                        ImgTarget.RotateFlip(RotateFlipType.Rotate180FlipNone)<br />
                        g = Graphics.FromImage(ImgTarget)<br />
                        g.DrawImage(SourceImage, _<br />
                                      New Rectangle(ShadowDistance, ShadowDistance, _<br />
                                                        SourceImage.Width, SourceImage.Height), _<br />
                                      0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)<br />
                    Case ShadowDirections.TOP_RIGHT<br />
                        g.Dispose()<br />
                        ImgTarget.RotateFlip(RotateFlipType.RotateNoneFlipY)<br />
                        g = Graphics.FromImage(ImgTarget)<br />
                        g.DrawImage(SourceImage, _<br />
                           New Rectangle(0, ShadowDistance, SourceImage.Width, SourceImage.Height), _<br />
                                  0, 0, SourceImage.Width, SourceImage.Height, GraphicsUnit.Pixel)<br />
                End Select</p>
<p>                g.Dispose()<br />
                g = Nothing<br />
                ImgShadow.Dispose()<br />
                ImgShadow = Nothing</p>
<p>                SourceImage = New Bitmap(ImgTarget)<br />
                ImgTarget.Dispose()<br />
                ImgTarget = Nothing<br />
            End If</p>
<p>        Catch ex As Exception<br />
            If g IsNot Nothing Then<br />
                g.Dispose()<br />
                g = Nothing<br />
            End If<br />
            If ImgShadow IsNot Nothing Then<br />
                ImgShadow.Dispose()<br />
                ImgShadow = Nothing<br />
            End If<br />
            If ImgTarget IsNot Nothing Then<br />
                ImgTarget.Dispose()<br />
                ImgTarget = Nothing<br />
            End If<br />
        End Try</p>
<p>    End Sub<br />
[/sourcecode]</p>
<p>Besides, You can use this sub as in the following example (take a look at the comments&#8230;) :</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
        Dim file_input As String = &quot;c:myfile.jpg&quot;<br />
        Dim file_output As String = &quot;c:myfilewithshadow.jpg&quot;</p>
<p>        &#8216;get bitmap&#8230;<br />
        Dim sourceImage As System.Drawing.Image = System.Drawing.Image.FromFile(file_input)<br />
        Dim format As System.Drawing.Imaging.ImageFormat = sourceImage.RawFormat<br />
        Dim bmpOut As System.Drawing.Bitmap = New Bitmap(sourceImage)</p>
<p>        &#8216;release any reference to the original file&#8230;<br />
        While sourceImage IsNot Nothing<br />
            sourceImage.Dispose()<br />
            sourceImage = Nothing<br />
        End While</p>
<p>        &#8216;drop black shadow on new bitmap with white background&#8230;<br />
        DropShadow(bmpOut, Color.Black, Color.White)</p>
<p>        &#8216;save file&#8230;<br />
        If bmpOut IsNot Nothing Then<br />
            bmpOut.Save(file_output, format)<br />
            bmpOut.Dispose()<br />
            bmpOut = Nothing<br />
        End If<br />
[/sourcecode]</p>
<p>PS:<br />
The subroutine executes only in &#8220;STAThread&#8221; so it&#8217;s thread-safe drawing.</p>
<p>Happy coding&#8230;</p>
<p>Max 🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">72</post-id>	</item>
		<item>
		<title>How to remove accent marks and german umlauts from URLs and Strings in .NET</title>
		<link>https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/</link>
					<comments>https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 06 Sep 2019 14:40:50 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[char]]></category>
		<category><![CDATA[char-conversion]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[intellisense]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[String-class]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=51</guid>

					<description><![CDATA[I wrote two functions in .NET to remove easly any accent and umlaut marks from a string and to get the equivalent non-accented string, this is very useful to normalize URLs; for example, with the StripAccentMarks() method, from &#8220;àbcdèéfghìlmnòpqrstùvzäöüÄÖÜ&#8221; u&#8217;ll &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/" aria-label="How to remove accent marks and german umlauts from URLs and Strings in .NET">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>I wrote two functions in .NET to remove easly any accent and umlaut marks from a string and to get the equivalent non-accented string, this is very useful to normalize URLs; for example, with the <em>StripAccentMarks()</em> method, from &#8220;àbcdèéfghìlmnòpqrstùvzäöüÄÖÜ&#8221; u&#8217;ll get &#8220;abcdeefghilmnopqrstuvzaouAOU&#8221;;</p>
<p>besides, if u&#8217;ll need to convert each german umlaut to the corresponding two-letter chars, u can also use the <em>ReplaceGermanUmlauts()</em> method&#8230;</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Public Shared Function StripAccentMarks(ByVal input_string As String) As String<br />
   Dim n_s As String = input_string.Normalize(NormalizationForm.FormD)<br />
   Dim s As New StringBuilder()<br />
   Dim c As Char<br />
   For i As Integer = 0 To n_s.Length &#8211; 1<br />
      c = n_s(i)<br />
      If System.Globalization.CharUnicodeInfo.GetUnicodeCategory(c) &lt;&gt; System.Globalization.UnicodeCategory.NonSpacingMark Then<br />
         s.Append(c)<br />
      End If<br />
   Next<br />
   Return s.ToString<br />
End Function<br />
[/sourcecode]<br />
[sourcecode language=&#8221;vb&#8221;]<br />
Public Shared Function ReplaceGermanUmlauts(ByVal input_string As String) As String<br />
   Dim s As String = input_string&lt;/pre&gt;<br />
s = s.Replace(&quot;ä&quot;, &quot;ae&quot;)<br />
 s = s.Replace(&quot;ö&quot;, &quot;oe&quot;)<br />
 s = s.Replace(&quot;ü&quot;, &quot;ue&quot;)<br />
 s = s.Replace(&quot;Ä&quot;, &quot;Ae&quot;)<br />
 s = s.Replace(&quot;Ö&quot;, &quot;Oe&quot;)<br />
 s = s.Replace(&quot;Ü&quot;, &quot;Ue&quot;)<br />
 s = s.Replace(&quot;ß&quot;, &quot;ss&quot;)<br />
 Return s<br />
End Function<br />
[/sourcecode]</p>
<p>Have a nice day!</p>
<p>Max 😀</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">51</post-id>	</item>
		<item>
		<title>Multilingual applications with VB.NET</title>
		<link>https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/</link>
					<comments>https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 09 Aug 2019 14:36:19 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[application]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[compile]]></category>
		<category><![CDATA[compiler]]></category>
		<category><![CDATA[compiling]]></category>
		<category><![CDATA[culture-codename]]></category>
		<category><![CDATA[enumerate]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[intellisense]]></category>
		<category><![CDATA[language]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[module]]></category>
		<category><![CDATA[multi-language]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[resource]]></category>
		<category><![CDATA[resx]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[String-class]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[visual-studio]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=49</guid>

					<description><![CDATA[In this simple tutorial you&#8217;ll learn how to manage different languages for a vb.NET application and the simplest way to access programmatically to the string values in the resource compiled files (*.resx) created by Visual Studio; Adding resource files: First &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/" aria-label="Multilingual applications with VB.NET">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>In this simple tutorial you&#8217;ll learn how to manage different languages for a vb.NET application and the simplest way to access programmatically to the string values in the resource compiled files (*.resx) created by Visual Studio;</p>
<p><strong>Adding resource files:</strong></p>
<p>First of all, add a folder named &#8220;resources/&#8221; in your project.</p>
<p>Inside this folder, right click then from the context menu choose &#8220;add an element&#8221; -> &#8220;new element&#8221; -> select &#8220;Resource File (resx)&#8221; -> create a file named &#8220;Resources.en-US.resx&#8221;</p>
<p>In the &#8220;Resources.en-US.resx&#8221; file, You have to write all the strings used by your application.<br />
It&#8217;s important that your language resource file is named as &#8220;Resources.{Language Code Name}.resx&#8221;, so VS can reach automatically this file.</p>
<p>The rsx file is just a list of Key-Value items, then You have to give a key-name for each string value; don&#8217;t use spaces in key-names, otherwise it&#8217;s best using &#8220;_&#8221; symbol.</p>
<p>Insert only two test lines in your new rsx file as the following&#8230;</p>
<p>KEY &#8211; VALUE:<br />
<code><br />
TEST_STRING1	us1<br />
TEST_STRING2	us2<br />
</code></p>
<p>Then, compile your project and if it&#8217;s all right, You will find a new folder in &#8220;binRelease&#8221; named &#8220;en-US&#8221; created by VS, with a file &#8220;{your project name}.resources.dll&#8221;; this file contains all the strings for the english-US language (&#8220;en-US&#8221;) and right now You can access them programmatically.</p>
<p>If You want add a new language to your application, just copy the rsx file and rename it in &#8220;Resources.{Language Code Name}.resx&#8221; where the language code name is one of those listed at <a href="http://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx" title="http://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx" target="_blank" rel="noopener noreferrer">http://msdn.microsoft.com/en-us/library/ee825488(v=cs.20).aspx</a>.</p>
<p><strong>Step 2, how to programmatically select the language and strings:</strong></p>
<p>Add a vb class &#8220;Resources.vb&#8221; in the &#8220;resources&#8221; folder with the following code</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Public Class Resources</p>
<p>    Public Shared Function GetValue(ByVal name As ResourceName) As String<br />
        Return My.Resources.ResourceManager.GetObject(name.ToString)<br />
    End Function</p>
<p>    Public Shared Property Language() As CultureCodeName<br />
        Get<br />
            Dim c As CultureCodeName = Nothing<br />
            Dim cs As String = System.Threading.Thread.CurrentThread.CurrentUICulture.ToString().Replace(New Char() {&quot;-&quot;c}, New Char() {&quot;_&quot;c})<br />
            For Each cc As CultureCodeName In [Enum].GetValues(GetType(CultureCodeName))<br />
                If cs = cc.ToString Then<br />
                    c = cc<br />
                    Exit For<br />
                End If<br />
            Next<br />
            Return c<br />
        End Get<br />
        Set(ByVal cultureCodeName As CultureCodeName)<br />
            Dim c As String = cultureCodeName.ToString.Replace(New Char() {&quot;_&quot;c}, New Char() {&quot;-&quot;c})<br />
            System.Threading.Thread.CurrentThread.CurrentUICulture = _<br />
                            System.Globalization.CultureInfo.GetCultureInfo(c)<br />
        End Set<br />
    End Property</p>
<p>End Class<br />
[/sourcecode]</p>
<p>then, add a vb &#8220;code file&#8221; named &#8220;CultureCodeNames.vb&#8221; in &#8220;resources&#8221; folder with the following code</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>Public Enum CultureCodeName</p>
<p>    en_US<br />
    &#8216;if You want add a new language, after creating the rsx file,<br />
    &#8216;also add here the code name, with &quot;-&quot; replaced in &quot;_&quot;</p>
<p>End Enum</p>
<p>[/sourcecode]</p>
<p>Finally, add the last vb codefile &#8220;ResourceNames.vb&#8221; in &#8220;resources&#8221; folder with this code</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>Public Enum ResourceName</p>
<p>    &#8216;add here all the key names in the RSX file<br />
    TEST_STRING1<br />
    TEST_STRING2</p>
<p>End Enum</p>
<p>[/sourcecode]</p>
<p>The configuration is finished.<br />
In your project, add a button to a form, then add the following vb code in the <em>codebehind</em> to learn how to access to different language RSX files and their strings inside.</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click</p>
<p>        &#8216;Select a language for your app<br />
        Resources.Language = CultureCodeName.en_US</p>
<p>        &#8216;show test string 1<br />
        MessageBox.Show(Resources.GetValue(ResourceName.TEST_STRING1))</p>
<p>        &#8216;show test string 2<br />
        MessageBox.Show(Resources.GetValue(ResourceName.TEST_STRING2))</p>
<p>        &#8216;show the current language code<br />
        MessageBox.Show(Resources.Language.ToString)</p>
<p>    End Sub<br />
[/sourcecode]</p>
<p>It&#8217;s very useful because when you will be writing the code, VS automatically suggests the strings that you can use, saving a lot of time and by selecting a language with &#8220;Resources.Language&#8221;, You can translate your application strings on the fly. </p>
<p>Have a nice day!</p>
<p>Max</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">49</post-id>	</item>
		<item>
		<title>How to implement IsNumeric() VB.NET function in C#</title>
		<link>https://www.maxvergelli.com/how-to-implement-isnumeric-vb-net-function-in-c-sharp/</link>
					<comments>https://www.maxvergelli.com/how-to-implement-isnumeric-vb-net-function-in-c-sharp/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 12 Jul 2019 14:30:42 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[numeric-conversion]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vb.net]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=47</guid>

					<description><![CDATA[This article describes how to implement the useful &#8220;IsNumeric&#8221; function in Microsoft Visual Basic .NET in Visual C#. The IsNumeric() function returns a Boolean value indicating whether an expression can be evaluated as a number. The IsNumeric() function returns True &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-implement-isnumeric-vb-net-function-in-c-sharp/" aria-label="How to implement IsNumeric() VB.NET function in C#">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>This article describes how to implement the useful &#8220;IsNumeric&#8221; function in Microsoft Visual Basic .NET in Visual C#. The IsNumeric() function returns a <em>Boolean</em> value indicating whether an expression can be evaluated as a number. The IsNumeric() function returns <em>True</em> when the data type of the expression is Short, Integer, Long, Decimal, Single or Double. Returns <em>True</em> if the expression is a string that can be converted to a Double. </p>
<p>Add the following code to your project:</p>
<p>[sourcecode language=&#8221;csharp&#8221;]<br />
// IsNumeric Function<br />
static bool IsNumeric(object Expression)<br />
{<br />
// Variable to collect the Return value of the TryParse method.<br />
	bool isNum;</p>
<p>// Define variable to collect out parameter of the TryParse method. If the conversion fails, the out parameter is zero.<br />
	double retNum;</p>
<p>// The TryParse method converts a string in a specified style and culture-specific format to its double-precision floating point number equivalent.<br />
// The TryParse method does not generate an exception if the conversion fails. If the conversion passes, True is returned. If it does not, False is returned.<br />
	isNum = Double.TryParse(Convert.ToString(Expression), System.Globalization.NumberStyles.Any, System.Globalization.NumberFormatInfo.InvariantInfo, out retNum );<br />
	return isNum;<br />
}<br />
[/sourcecode]</p>
<p>Have a nice day!</p>
<p>Max 🙂</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-implement-isnumeric-vb-net-function-in-c-sharp/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">47</post-id>	</item>
		<item>
		<title>MySqlHelper VB.NET class &#8211; easly execute commands against a MySQL database</title>
		<link>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/</link>
					<comments>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 01 Jun 2016 14:28:05 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[command]]></category>
		<category><![CDATA[connection-string]]></category>
		<category><![CDATA[connector-net]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[data-adapter]]></category>
		<category><![CDATA[data-layer]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[database-connector]]></category>
		<category><![CDATA[dataset]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[db]]></category>
		<category><![CDATA[execute-scalar]]></category>
		<category><![CDATA[execute-sql-programmatically]]></category>
		<category><![CDATA[extension]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[helper-class]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysql-client]]></category>
		<category><![CDATA[mysql-command]]></category>
		<category><![CDATA[mysql-database-connector]]></category>
		<category><![CDATA[mysql-datetime]]></category>
		<category><![CDATA[mysql-datetime-conversion]]></category>
		<category><![CDATA[mysql-parameter]]></category>
		<category><![CDATA[record]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[sql-command]]></category>
		<category><![CDATA[sql-reader]]></category>
		<category><![CDATA[stored-procedure]]></category>
		<category><![CDATA[vb.net]]></category>
		<category><![CDATA[wrapper-class]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=45</guid>

					<description><![CDATA[Hi all, with the following free .net helper class you can easly execute SQL commands against a MySQL database, execute stored procedures, get or programmatically update tables/DataSet objects and convert to and from MySQL datetime types. Enjoy! 🙂 [sourcecode language=&#8221;vb&#8221;] &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/" aria-label="MySqlHelper VB.NET class &#8211; easly execute commands against a MySQL database">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>Hi all, with the following free .net helper class you can easly execute SQL commands against a MySQL database, execute stored procedures, get or programmatically update tables/DataSet objects and convert to and from MySQL datetime types.</p>
<p>Enjoy! 🙂</p>
<p>[sourcecode language=&#8221;vb&#8221;]</p>
<p>&#8216;	MySqlHelper VB.NET class<br />
&#8216;	http://www.maxvergelli.com/</p>
<p>&#8216;	Copyright (c) 2016 Max Vergelli</p>
<p>&#8216;   Vers. 2.1.0<br />
&#8216;   Date: 21/03/2016</p>
<p>&#8216;   Description:<br />
&#8216;   .NET helper class to easly execute SQL commands against a MySQL database,<br />
&#8216;   execute stored procedures, get or programmatically update DataSet objects,<br />
&#8216;   and convert to and from MySQL datetime types.<br />
&#8216;<br />
&#8216;   Before use this class, You have to install and import in your project the<br />
&#8216;   last MySQL Connector/NET at<br />
&#8216;   http://dev.mysql.com/doc/refman/5.0/es/connector-net.html</p>
<p>&#8216;	Permission is hereby granted, free of charge, to any person obtaining a copy<br />
&#8216;	of this software and associated documentation files (the &quot;Software&quot;), to deal<br />
&#8216;	in the Software without restriction, including without limitation the rights<br />
&#8216;	to use, copy, modify, merge, publish, distribute, sublicense, and/or sell<br />
&#8216;	copies of the Software, and to permit persons to whom the Software is<br />
&#8216;	furnished to do so, subject to the following conditions:</p>
<p>&#8216;	The above copyright notice and this permission notice shall be included in<br />
&#8216;	all copies or substantial portions of the Software.</p>
<p>&#8216;	THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br />
&#8216;	IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br />
&#8216;	FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE<br />
&#8216;	AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br />
&#8216;	LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,<br />
&#8216;	OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN<br />
&#8216;	THE SOFTWARE.</p>
<p>Imports System.Data<br />
Imports System.Globalization<br />
Imports MySql.Data.MySqlClient</p>
<p>Public Class MySqlHelper</p>
<p>    Private _cnx_string As String = Nothing<br />
    Private _cnx_obj As MySqlConnection = Nothing</p>
<p>    Private Function IsConnectionAlive() As Boolean<br />
        Dim is_alive As Boolean = False<br />
        If _cnx_obj IsNot Nothing AndAlso _cnx_obj.State &lt;&gt; ConnectionState.Closed Then<br />
            is_alive = True<br />
        End If<br />
        Return is_alive<br />
    End Function</p>
<p>    Private Sub CloseConnection()</p>
<p>        Try</p>
<p>            If IsConnectionAlive() Then<br />
                _cnx_obj.Close()<br />
            End If<br />
            _cnx_obj = Nothing</p>
<p>        Catch ex As Exception</p>
<p>            _cnx_obj = Nothing</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    Public ReadOnly Property ConnectionString() As String<br />
        Get<br />
            Return _cnx_string<br />
        End Get<br />
    End Property</p>
<p>    Public Function IsOpen() As Boolean<br />
        Return IsConnectionAlive()<br />
    End Function</p>
<p>    Public Sub New(Optional ByVal db_connection_string As String = &quot;&quot;, _<br />
                   Optional ByVal open_connection As Boolean = False)</p>
<p>        _cnx_string = db_connection_string</p>
<p>        If _cnx_string.Length &gt; 0 And open_connection = True Then</p>
<p>            Dim is_open As Boolean = Open(_cnx_string)</p>
<p>        End If</p>
<p>    End Sub</p>
<p>    Public Function Open(ByVal db_connection_string As String) As Boolean</p>
<p>        Dim success As Boolean = False<br />
        Try</p>
<p>            If IsConnectionAlive() = False Then</p>
<p>                If db_connection_string.Length &gt; 0 AndAlso _cnx_obj Is Nothing Then</p>
<p>                    _cnx_string = db_connection_string<br />
                    _cnx_obj = New MySqlConnection<br />
                    _cnx_obj.ConnectionString = _cnx_string<br />
                    _cnx_obj.Open()<br />
                    success = True</p>
<p>                End If</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            CloseConnection()<br />
            success = False</p>
<p>        End Try<br />
        Return success</p>
<p>    End Function</p>
<p>    Public Sub Close()</p>
<p>        CloseConnection()</p>
<p>    End Sub</p>
<p>    Protected Overrides Sub Finalize()<br />
        CloseConnection()<br />
    End Sub</p>
<p>    &#8216;get a DataRow object with the first row of a SQL select command<br />
    Public Function SelectFirstRow(ByVal sql_select As String) As DataRow</p>
<p>        Dim ds As DataSet = SelectRows(sql_select)<br />
        If ds Is Nothing Then<br />
            Return Nothing<br />
        End If<br />
        If ds.Tables.Count &lt; 1 Then<br />
            Return Nothing<br />
        End If<br />
        If ds.Tables(0).Rows.Count &lt; 1 Then<br />
            Return Nothing<br />
        End If<br />
        Return ds.Tables(0).Rows(0)</p>
<p>    End Function</p>
<p>    &#8216;get a DataSet object with the rows of a SQL select command<br />
    Public Function SelectRows(ByVal sql_select As String) As DataSet</p>
<p>        Dim ds As DataSet = Nothing<br />
        Try</p>
<p>            If IsConnectionAlive() Then</p>
<p>                Dim cmd As MySqlCommand = New MySqlCommand(sql_select, _cnx_obj)</p>
<p>                Dim da As MySqlDataAdapter = New MySqlDataAdapter<br />
                da.SelectCommand = cmd</p>
<p>                ds = New DataSet<br />
                da.Fill(ds)</p>
<p>                da = Nothing</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            ds = Nothing</p>
<p>        End Try<br />
        Return ds</p>
<p>    End Function</p>
<p>    &#8216;Execute a MySql Stored Procedure<br />
    Public Overloads Function ExecuteStoredProcedure(ByVal stored_procedure_name As String) As DataSet</p>
<p>        Return ExecuteProcedure(stored_procedure_name)</p>
<p>    End Function</p>
<p>    &#8216;Execute a MySql Stored Procedure with parameters</p>
<p>    &#8216;How to create the parameters<br />
    &#8216;Dim param As MySqlParameter = New MySqlParameter(&quot;?v_id&quot;, MySqlDbType.Int32)<br />
    &#8216;param.Value = 1<br />
    &#8216;param.Direction = ParameterDirection.Input</p>
<p>    Public Overloads Function ExecuteStoredProcedure(ByVal stored_procedure_name As String, _<br />
                                                     ByVal ParamArray parameters As MySqlParameter()) As DataSet</p>
<p>        Return ExecuteProcedure(stored_procedure_name, parameters)</p>
<p>    End Function</p>
<p>    Private Function ExecuteProcedure(ByVal procedure_name As String, _<br />
                                            ByVal ParamArray sql_parameters As MySqlParameter()) As DataSet</p>
<p>        Dim ds As DataSet = Nothing<br />
        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(procedure_name, _cnx_obj)</p>
<p>                cmd.CommandType = CommandType.StoredProcedure</p>
<p>                If sql_parameters IsNot Nothing Then<br />
                    For Each p As MySqlParameter In sql_parameters<br />
                        cmd.Parameters.Add(p)<br />
                    Next<br />
                End If</p>
<p>                Dim da As MySqlDataAdapter = New MySqlDataAdapter<br />
                da.SelectCommand = cmd<br />
                ds = New DataSet<br />
                da.Fill(ds)<br />
                da = Nothing</p>
<p>                cmd.Parameters.Clear()</p>
<p>            End If<br />
        Catch ex As Exception</p>
<p>            ds = Nothing</p>
<p>        End Try</p>
<p>        Return ds</p>
<p>    End Function</p>
<p>    &#8216;UpdateRows() function automatically generates single-table commands used to reconcile changes made to a DataSet<br />
    &#8216;with the associated table in the MySQL database.<br />
    &#8216;The function gets<br />
    &#8216; &#8211; the SQL SELECT used to populate the dataset<br />
    &#8216; &#8211; the updated dataset<br />
    &#8216; &#8211; the table name that must be updated in the database<br />
    &#8216;Note:<br />
    &#8216;The SQL SELECT must also return at least one primary key or unique column, otherwise an exception is generated;</p>
<p>    Public Function UpdateRows(ByVal sql_select As String, ByRef input_dataset As DataSet, ByVal table_name As String) As Boolean</p>
<p>        Dim success As Boolean = False<br />
        Try</p>
<p>            If IsConnectionAlive() Then</p>
<p>                Dim data_adapter As New MySqlDataAdapter(sql_select, _cnx_obj)<br />
                Dim cmd_builder As New MySqlCommandBuilder(data_adapter)<br />
                data_adapter.Update(input_dataset, table_name)<br />
                success = True</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            success = False</p>
<p>        End Try</p>
<p>        Return success</p>
<p>    End Function</p>
<p>    &#8216;To use a MySqlDataReader,<br />
    &#8216;You have to use OpenReader() and CloseReader() functions like in the following example:<br />
    &#8216;<br />
    &#8216;    Public Sub ReadMyData(ByVal connection_string As String)<br />
    &#8216;<br />
    &#8216;        Dim mysql As MySqlHelper = New MySqlHelper()<br />
    &#8216;        mysql.Open(connection_string)<br />
    &#8216;<br />
    &#8216;        Dim sql As String = &quot;SELECT OrderID, CustomerID FROM Orders&quot;<br />
    &#8216;        Dim reader As MySqlDataReader = Nothing<br />
    &#8216;<br />
    &#8216;        mysql.OpenReader(reader, sql)<br />
    &#8216;        While reader.Read()<br />
    &#8216;            Console.WriteLine((reader.GetInt32(0) &amp; &quot;, &quot; &amp; reader.GetString(1)))<br />
    &#8216;        End While<br />
    &#8216;        mysql.CloseReader(reader)<br />
    &#8216;<br />
    &#8216;        mysql.Close()<br />
    &#8216;<br />
    &#8216;    End Sub</p>
<p>    Public Sub OpenReader(ByRef reader As MySqlDataReader, ByVal sql_select As String)</p>
<p>        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_select, _cnx_obj)<br />
                reader = cmd.ExecuteReader()</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            reader = Nothing</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    Public Sub CloseReader(ByRef reader As MySqlDataReader)</p>
<p>        Try</p>
<p>            reader.Close()</p>
<p>        Catch ex As Exception</p>
<p>        End Try</p>
<p>    End Sub</p>
<p>    &#8216;Execute SQL command and return the number of records affected<br />
    Public Function Execute(ByVal sql_command As String) As Long</p>
<p>        Dim affected_rows As Long = 0</p>
<p>        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_command, _cnx_obj)</p>
<p>                affected_rows = cmd.ExecuteNonQuery()</p>
<p>            End If</p>
<p>        Catch ex As Exception</p>
<p>            affected_rows = 0</p>
<p>        End Try</p>
<p>        Return affected_rows</p>
<p>    End Function</p>
<p>    &#8216;GetSingleValue() function executes the query, and returns the value of the first column of the first row in the<br />
    &#8216;result set returned by the query. Extra columns or rows are ignored.<br />
    &#8216;Note:<br />
    &#8216;Use the GetSingleValue() method to retrieve a single value (for example, an aggregate value)<br />
    &#8216;from a database, like &quot;select count(*) from region&quot;</p>
<p>    Public Overloads Function GetSingleValue(ByVal sql_select As String) As Object</p>
<p>        Return ExecuteScalar(sql_select, DirectCast(Nothing, MySqlParameter()))</p>
<p>    End Function</p>
<p>    Public Overloads Function GetSingleValue(ByVal sql_select As String, ByVal ParamArray sql_parameters As MySqlParameter()) As Object</p>
<p>        Return ExecuteScalar(sql_select, sql_parameters)</p>
<p>    End Function</p>
<p>    &#8216;ExecuteScalar: Executes the query, and returns the value (integer/string) of the first column of the first row in the result set returned by the query. Extra columns or rows are ignored.<br />
    Private Function ExecuteScalar(ByVal sql_select As String, ByVal ParamArray sql_parameters As MySqlParameter()) As Object</p>
<p>        Dim row As Object = Nothing<br />
        Try<br />
            If IsConnectionAlive() Then</p>
<p>                Dim cmd As New MySqlCommand(sql_select, _cnx_obj)<br />
                If sql_parameters IsNot Nothing Then<br />
                    For Each p As MySqlParameter In sql_parameters<br />
                        cmd.Parameters.Add(p)<br />
                    Next<br />
                End If<br />
                row = cmd.ExecuteScalar()<br />
                cmd.Parameters.Clear()</p>
<p>            End If<br />
        Catch ex As Exception</p>
<p>            row = Nothing</p>
<p>        End Try</p>
<p>        Return row</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 -&gt; 2012-01-25<br />
    Public Overloads Function ConvertToMySqlDate(ByVal input_date As Date) As String</p>
<p>        Return input_date.ToString(&quot;yyyy-MM-dd&quot;)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 -&gt; 2012-01-25<br />
    Public Overloads Function ConvertToMySqlDate(ByVal input_date As String) As String</p>
<p>        Return ConvertDateTime(input_date, DATETIME_TYPE.MYSQL, True)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 13:00 -&gt; 2012-01-25 13:00:00<br />
    Public Overloads Function ConvertToMySqlDateTime(ByVal input_datetime As DateTime) As String</p>
<p>        Return input_datetime.ToString(&quot;yyyy-MM-dd HH:mm:ss&quot;)</p>
<p>    End Function</p>
<p>    &#8217;25/1/12 13:00 -&gt; 2012-01-25 13:00:00<br />
    Public Overloads Function ConvertToMySqlDateTime(ByVal input_datetime As String) As String</p>
<p>        Return ConvertDateTime(input_datetime, DATETIME_TYPE.MYSQL)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 -&gt; 25-01-2012<br />
    Public Overloads Function ConvertToDate(ByVal mysql_date As Date) As String</p>
<p>        Return mysql_date.ToString(&quot;dd-MM-yyyy&quot;)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 -&gt; 25-01-2012<br />
    Public Overloads Function ConvertToDate(ByVal mysql_date As String) As String</p>
<p>        Return ConvertDateTime(mysql_date, DATETIME_TYPE.SYSTEM, True)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 13:00:00 -&gt; 25-01-2012 13:00:00<br />
    Public Overloads Function ConvertToDateTime(ByVal mysql_datetime As DateTime) As String</p>
<p>        Return mysql_datetime.ToString(&quot;dd-MM-yyyy HH:mm:ss&quot;)</p>
<p>    End Function</p>
<p>    &#8216;2012-01-25 13:00:00 -&gt; 25-01-2012 13:00:00<br />
    Public Overloads Function ConvertToDateTime(ByVal mysql_datetime As String) As String</p>
<p>        Return ConvertDateTime(mysql_datetime, DATETIME_TYPE.SYSTEM)</p>
<p>    End Function</p>
<p>    Private Enum DATETIME_TYPE As Integer<br />
        SYSTEM = 0<br />
        MYSQL = 1<br />
    End Enum</p>
<p>    Private Function ConvertDateTime(ByVal input_datetime As String, ByVal output_datetime_type As DATETIME_TYPE, _<br />
                                                                    Optional ByVal get_only_date As Boolean = False) As String</p>
<p>        &#8216;The function returns a datetime in a well-formatted string for regular or MySQL use.<br />
        &#8216;You have to insert a datetime string formatted by {,/,-,.,:} symbols.<br />
        &#8216;Besides, for the input date, You need to specify &quot;day, month and year&quot;;<br />
        &#8216;for the time, only &quot;hour and minutes&quot;, &quot;seconds&quot; doesn&#8217;t matter.</p>
<p>        &#8216;The function returns Nothing if an error is encountered.</p>
<p>        &#8216;You can select one of the following datetime types as output:<br />
        &#8216;SYSTEM: &quot;(2 digits day)-(2 digits month)-(4 digits year) hours:minutes:seconds&quot;<br />
        &#8216;MYSQL: &quot;(4 digits year)-(2 digits month)-(2 digits day) hours:minutes:seconds&quot;</p>
<p>        &#8216;examples:<br />
        &#8216;for a regular datetime in input and<br />
        &#8216;a MySql datetime as output, You &#8216;ll get&#8230;</p>
<p>        &#8217;25-1-08 -&gt; 2008-01-25 00:00:00<br />
        &#8217;25/1/08 -&gt; 2008-01-25 00:00:00<br />
        &#8217;25/1/08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8217;25-1-08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12:00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12.00 -&gt; 2008-01-25 12:00:00<br />
        &#8216;25.1.08 12.00.23 -&gt; 2008-01-25 12:00:23</p>
<p>        Dim dt_out As String = Nothing<br />
        Dim dt_type As String = &quot;&quot;<br />
        If output_datetime_type = DATETIME_TYPE.MYSQL Then<br />
            dt_type = &quot;yyyy-MM-dd HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
        Else<br />
            dt_type = &quot;dd-MM-yyyy HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
        End If<br />
        Try<br />
            If input_datetime.IndexOf(&quot;.&quot;, 0, CompareMethod.Binary) &gt; 0 Then<br />
                Dim tmp() As String = input_datetime.Split(&quot; &quot;)<br />
                If tmp.GetUpperBound(0) &gt; 0 Then<br />
                    input_datetime = tmp(0).Replace(&quot;.&quot;, &quot;-&quot;) &amp; &quot; &quot; &amp; tmp(1).Replace(&quot;.&quot;, &quot;:&quot;)<br />
                End If<br />
            End If<br />
            Dim myDTFI As DateTimeFormatInfo = New CultureInfo(&quot;it-IT&quot;, False).DateTimeFormat<br />
            myDTFI.FullDateTimePattern = &quot;dd-MM-yyyy HH&#8217;:&#8217;mm&#8217;:&#8217;ss&quot;<br />
            myDTFI.DateSeparator = &quot;-&quot;<br />
            myDTFI.TimeSeparator = &quot;:&quot;<br />
            Dim myDT As New DateTime<br />
            myDT = System.Convert.ToDateTime(input_datetime, myDTFI)<br />
            dt_out = Format(myDT, dt_type)<br />
            myDT = Nothing<br />
            myDTFI = Nothing<br />
            If get_only_date = True Then<br />
                Dim s() As String = dt_out.Split(&quot; &quot;)<br />
                If s.GetUpperBound(0) &gt; 0 Then<br />
                    dt_out = s(0)<br />
                End If<br />
            End If<br />
        Catch ex As Exception<br />
            dt_out = Nothing<br />
        End Try<br />
        Return dt_out</p>
<p>    End Function</p>
<p>End Class</p>
<p>[/sourcecode]</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/mysqlhelper-vb-net-class-execute-commands-against-a-mysql-database/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">45</post-id>	</item>
		<item>
		<title>How to extract text content from tags in VB.Net</title>
		<link>https://www.maxvergelli.com/how-to-extract-text-content-from-tags-in-vb-net/</link>
					<comments>https://www.maxvergelli.com/how-to-extract-text-content-from-tags-in-vb-net/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 27 May 2016 14:56:42 +0000</pubDate>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[filtering]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[parse]]></category>
		<category><![CDATA[parsing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[String-class]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vb.net]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=32</guid>

					<description><![CDATA[With this simple vb.net function You are able to extract content from HTML tags, useful and smart Max 🙂 [sourcecode language=&#8221;vb&#8221;] Public Function GetTagContent(ByRef html As String, ByVal start_tag As String, ByVal end_tag As String) As String Dim s As &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/how-to-extract-text-content-from-tags-in-vb-net/" aria-label="How to extract text content from tags in VB.Net">Read More</a>]]></description>
										<content:encoded><![CDATA[<p>With this simple vb.net function You are able to extract content from HTML tags, useful and smart</p>
<p>Max 🙂</p>
<p>[sourcecode language=&#8221;vb&#8221;]<br />
Public Function GetTagContent(ByRef html As String, ByVal start_tag As String, ByVal end_tag As String) As String<br />
Dim s As String = &quot;&quot;<br />
 Dim content() As String = html.Split(start_tag)<br />
 If content.Count &gt; 1 Then<br />
 Dim parts() As String = content(1).Split(end_tag)<br />
 If parts.Count &gt; 1 Then<br />
 s = parts(0)<br />
 End If<br />
 End If<br />
 Return s<br />
End Function<br />
[/sourcecode]</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/how-to-extract-text-content-from-tags-in-vb-net/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">32</post-id>	</item>
	</channel>
</rss>
