<?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>VB.Net | MaxVergelli.com</title>
	<atom:link href="https://www.maxvergelli.com/category/programming/vb-net/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>VB.Net | 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[<p>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</p>
<p>The post <a href="https://www.maxvergelli.com/create-an-excel-file-in-c-without-microsoft-office-or-third-party-plugins/">Create an Excel file in C# without Microsoft Office or Third party plugins</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/create-an-excel-file-in-c-without-microsoft-office-or-third-party-plugins/">Create an Excel file in C# without Microsoft Office or Third party plugins</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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>Render a Section in a Partial View &#8211; ASP.Net MVC</title>
		<link>https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/</link>
					<comments>https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/#respond</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Sun, 12 Apr 2020 15:34:00 +0000</pubDate>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[asp.net-mvc]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[mvc]]></category>
		<category><![CDATA[mvc-partial-view]]></category>
		<category><![CDATA[mvc-project]]></category>
		<category><![CDATA[mvc-view]]></category>
		<category><![CDATA[partial-view]]></category>
		<category><![CDATA[razor]]></category>
		<category><![CDATA[render]]></category>
		<category><![CDATA[section]]></category>
		<category><![CDATA[vb.net]]></category>
		<guid isPermaLink="false">https://www.maxvergelli.com/?p=231</guid>

					<description><![CDATA[<p>Let&#8217;s start with the following configuration to give an example: in a MVC project, you have a &#8220;_Layout.vbhtml&#8221; file with this code Then, you have a Partial View &#8220;ValidationScripts.vbhtml&#8221; in the Shared folder with If you call the Partial View &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/" aria-label="Render a Section in a Partial View &#8211; ASP.Net MVC">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/">Render a Section in a Partial View – ASP.Net MVC</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>Let&#8217;s start with the following configuration to give an example: in a MVC project, you have a &#8220;_Layout.vbhtml&#8221; file with this code</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
	&lt;!-- some code here --&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery-1.8.2.min.js&quot;)&quot;&gt;		&lt;/script&gt;
    @RenderSection(&quot;Scripts&quot;, false)
  &lt;/body&gt;
&lt;/html&gt;</pre></div>



<p>Then, you have a Partial View &#8220;ValidationScripts.vbhtml&#8221; in the Shared folder with</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">@Section Scripts
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.validate.min.js&quot;)&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.validate.unobtrusive.min.js&quot;)&quot;&gt;&lt;/script&gt;
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery.validate.fix.js&quot;)&quot;&gt;&lt;/script&gt;  
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/localization/messages_de.js&quot;)&quot;&gt;&lt;/script&gt;      
End Section</pre></div>



<p>If you call the Partial View from a View like this…</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">@ModelType MvcExample.MyModel
@Code
    ViewData(&quot;Title&quot;) = &quot;Test&quot;
End Code

@Html.Partial(&quot;ValidationScripts&quot;)

&lt;h2&gt;Just a Test&lt;/h2&gt;</pre></div>



<p>However the Section &#8220;Scripts&#8221; is not rendered on the page, and the output HTML will be&#8230;</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">&lt;!DOCTYPE html&gt;
&lt;html&gt;
  &lt;head&gt;
  &lt;/head&gt;
  &lt;body&gt;
    
    &lt;script src=&quot;@Url.Content(&quot;~/Scripts/jquery-1.8.2.min.js&quot;)&quot;&gt;&lt;/script&gt;

  &lt;/body&gt;
&lt;/html&gt;</pre></div>



<p><strong>Solution</strong></p>



<p>To render the Section in the Partial View, you need to create a couple of Extension methods like this:</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">public static class HtmlHelperExtensions
{
  private const string _jSViewDataName = &quot;RenderJavaScript&quot;;
  private const string _styleViewDataName = &quot;RenderStyle&quot;;

  public static void AddJavaScript(this HtmlHelper htmlHelper, 
                                   string scriptURL)
  {
    List&lt;string&gt; scriptList = htmlHelper.ViewContext.HttpContext
      .Items[HtmlHelperExtensions._jSViewDataName] as List&lt;string&gt;;
    if (scriptList != null)
    {
      if (!scriptList.Contains(scriptURL))
      {
        scriptList.Add(scriptURL);
      }
    }
    else
    {
      scriptList = new List&lt;string&gt;();
      scriptList.Add(scriptURL);
      htmlHelper.ViewContext.HttpContext
        .Items.Add(HtmlHelperExtensions._jSViewDataName, scriptList);
    }
  }

  public static MvcHtmlString RenderJavaScripts(this HtmlHelper HtmlHelper)
  {
    StringBuilder result = new StringBuilder();

    List&lt;string&gt; scriptList = HtmlHelper.ViewContext.HttpContext
      .Items[HtmlHelperExtensions._jSViewDataName] as List&lt;string&gt;;
    if (scriptList != null)
    {
      foreach (string script in scriptList)
      {
        result.AppendLine(string.Format(
          &quot;&lt;script type=\&quot;text/javascript\&quot; src=\&quot;{0}\&quot;&gt;&lt;/script&gt;&quot;, 
          script));
      }
    }

    return MvcHtmlString.Create(result.ToString());
  }

  public static void AddStyle(this HtmlHelper htmlHelper, string styleURL)
  {
    List&lt;string&gt; styleList = htmlHelper.ViewContext.HttpContext
      .Items[HtmlHelperExtensions._styleViewDataName] as List&lt;string&gt;;

   if (styleList != null)
   {
     if (!styleList.Contains(styleURL))
     {
       styleList.Add(styleURL);
     }
   }
   else
   {
     styleList = new List&lt;string&gt;();
     styleList.Add(styleURL);
     htmlHelper.ViewContext.HttpContext
       .Items.Add(HtmlHelperExtensions._styleViewDataName, styleList);
   }
 }

 public static MvcHtmlString RenderStyles(this HtmlHelper htmlHelper)
 {
   StringBuilder result = new StringBuilder();

   List&lt;string&gt; styleList = htmlHelper.ViewContext.HttpContext
     .Items[HtmlHelperExtensions._styleViewDataName] as List&lt;string&gt;;

   if (styleList != null)
   {
     foreach (string script in styleList)
     {
       result.AppendLine(string.Format(
         &quot;&lt;link href=\&quot;{0}\&quot; rel=\&quot;stylesheet\&quot; type=\&quot;text/css\&quot; /&gt;&quot;, 
         script));
     }
   }

  return MvcHtmlString.Create(result.ToString());
  }
}</pre></div>



<p>So, on any View or Partial View or Display/Edit Template you simply add what you need:</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">@{
  Html.AddJavaScript(&quot;http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js&quot;);
}</pre></div>



<p>Then, in your Layouts you render it where you want it! Like this markup&#8230;</p>



<div class="wp-block-codemirror-blocks-code-block alignfull code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vb&quot;,&quot;mime&quot;:&quot;text/x-vb&quot;,&quot;theme&quot;:&quot;material&quot;,&quot;lineNumbers&quot;:true,&quot;styleActiveLine&quot;:true,&quot;lineWrapping&quot;:true,&quot;readOnly&quot;:true,&quot;align&quot;:&quot;full&quot;,&quot;language&quot;:&quot;VB.NET&quot;,&quot;modeName&quot;:&quot;vb&quot;}">&lt;!DOCTYPE html&gt;
&lt;html lang=&quot;en&quot;&gt;
  &lt;head&gt;
  @Html.RenderStyles()
  @Html.RenderJavascripts()</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/">Render a Section in a Partial View – ASP.Net MVC</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/render-a-section-in-a-partial-view-asp-net-mvc/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">231</post-id>	</item>
		<item>
		<title>Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</title>
		<link>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/</link>
					<comments>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Wed, 18 Mar 2020 14:10:43 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MS Access]]></category>
		<category><![CDATA[MSSQL]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[String Manipulation Algorithms]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[date]]></category>
		<category><![CDATA[date-conversion]]></category>
		<category><![CDATA[datetime]]></category>
		<category><![CDATA[datetime-conversion]]></category>
		<category><![CDATA[function]]></category>
		<category><![CDATA[mysql-datetime]]></category>
		<category><![CDATA[mysql-datetime-conversion]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[timestamp]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[unix-timestamp]]></category>
		<category><![CDATA[vbscript]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=124</guid>

					<description><![CDATA[<p>To convert a datetime string value like &#8220;YYYY-MM-DD HH:MM:SS&#8221; to a Unix timestamp (the seconds from 01/01/1970 to the input datetime) You can use a conversion function as the following: Then, to get back the datetime from the Unix timestamp &#8230; <a class="kt-excerpt-readmore" href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/" aria-label="Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP">Read More</a></p>
<p>The post <a href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/">Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p>To convert a datetime string value like &#8220;YYYY-MM-DD HH:MM:SS&#8221; to a Unix timestamp (the seconds from 01/01/1970 to the input datetime) You can use a conversion function as the following:</p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&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;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function ConvertToUnixTimeStamp(input_datetime) 'As String 
  Dim d
  d = CDate(input_datetime) 
  ConvertToUnixTimeStamp = CStr(DateDiff(&quot;s&quot;, &quot;01/01/1970 00:00:00&quot;, d)) 
End Function</pre></div>



<p>Then, to get back the datetime from the Unix timestamp use the following code:</p>



<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&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;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function ConvertUnixTimeStampToDateTime(input_unix_timestamp) 'As String [regular datetime] 
  ConvertUnixTimeStampToDateTime = CStr(DateAdd(&quot;s&quot;, input_unix_timestamp, &quot;01/01/1970 00:00:00&quot;)) 
End Function</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/">Convert a DateTime string to a Unix timestamp in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/convert-a-datetime-string-to-a-unix-timestamp-in-vbscript-classic-asp/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">124</post-id>	</item>
		<item>
		<title>Base64 encoding / decoding functions in VbScript / Classic ASP</title>
		<link>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/</link>
					<comments>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/#comments</comments>
		
		<dc:creator><![CDATA[Max]]></dc:creator>
		<pubDate>Fri, 06 Mar 2020 13:43:10 +0000</pubDate>
				<category><![CDATA[Classic ASP]]></category>
		<category><![CDATA[Cryptography]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[VB.Net]]></category>
		<category><![CDATA[VBScript]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[algorithm]]></category>
		<category><![CDATA[asp]]></category>
		<category><![CDATA[base64]]></category>
		<category><![CDATA[classic-asp]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[conversion]]></category>
		<category><![CDATA[cryptography]]></category>
		<category><![CDATA[decoding]]></category>
		<category><![CDATA[decryption]]></category>
		<category><![CDATA[encoding]]></category>
		<category><![CDATA[encryption]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[string]]></category>
		<category><![CDATA[string-conversion]]></category>
		<category><![CDATA[string-manipulation]]></category>
		<category><![CDATA[vbscript]]></category>
		<guid isPermaLink="false">http://www.maxvergelli.com/?p=122</guid>

					<description><![CDATA[<p>With the following functions Base64Encode(sText) and Base64Decode(ByVal vCode), You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</p>
<p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></description>
										<content:encoded><![CDATA[<p><span id="result_box" class="" lang="en">With the following functions <em>Base64Encode(sText)</em> and <em>Base64Decode(ByVal vCode)</em>, You can easly encode/decode a text in/from base64 in VBScript/Classic ASP:</span></p>


<div class="wp-block-codemirror-blocks-code-block code-block"><pre class="CodeMirror" data-setting="{&quot;mode&quot;:&quot;vbscript&quot;,&quot;mime&quot;:&quot;text/vbscript&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;VBScript&quot;,&quot;modeName&quot;:&quot;vb&quot;}">Function Base64Encode(sText)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.nodeTypedValue = Stream_StringToBinary(sText)
  Base64Encode = oNode.text
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Function Base64Decode(ByVal vCode)
  Dim oXML, oNode
  Set oXML = CreateObject(&quot;Msxml2.DOMDocument.3.0&quot;)
  Set oNode = oXML.CreateElement(&quot;base64&quot;)
  oNode.dataType = &quot;bin.base64&quot;
  oNode.text = vCode
  Base64Decode = Stream_BinaryToString(oNode.nodeTypedValue)
  Set oNode = Nothing
  Set oXML = Nothing
End Function

Private Function Stream_StringToBinary(Text)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  BinaryStream.Open
  BinaryStream.WriteText Text
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeBinary
  BinaryStream.Position = 0
  Stream_StringToBinary = BinaryStream.Read
  Set BinaryStream = Nothing
End Function

Private Function Stream_BinaryToString(Binary)
  Const adTypeText = 2
  Const adTypeBinary = 1
  Dim BinaryStream 'As New Stream
  Set BinaryStream = CreateObject(&quot;ADODB.Stream&quot;)
  BinaryStream.Type = adTypeBinary
  BinaryStream.Open
  BinaryStream.Write Binary
  BinaryStream.Position = 0
  BinaryStream.Type = adTypeText
  BinaryStream.CharSet = &quot;us-ascii&quot;
  Stream_BinaryToString = BinaryStream.ReadText
  Set BinaryStream = Nothing
End Function</pre></div>



<p></p><p>The post <a href="https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/">Base64 encoding / decoding functions in VbScript / Classic ASP</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></content:encoded>
					
					<wfw:commentRss>https://www.maxvergelli.com/base64-encoding-decoding-functions-in-vbscript-classic-asp/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">122</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[<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: http://www.developerfusion.com/tools/convert/csharp-to-vb/ You can reverse code from VB.NET to C# too. 🙂</p>
<p>The post <a href="https://www.maxvergelli.com/c-sharp-code-to-vb-net-free-online-converter/">C# code to VB.NET free online converter</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/c-sharp-code-to-vb-net-free-online-converter/">C# code to VB.NET free online converter</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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[<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; Download the VB.NET/ASP.NET Associative Array Class from: https://sourceforge.net/projects/vbnetassocarray/ You will find a tutorial inside the archive.</p>
<p>The post <a href="https://www.maxvergelli.com/new-associative-array-class-for-vb-net-asp-net-and-c-sharp/">New Associative Array Class for VB.NET / ASP.NET and C#</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/new-associative-array-class-for-vb-net-asp-net-and-c-sharp/">New Associative Array Class for VB.NET / ASP.NET and C#</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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[<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 &#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></p>
<p>The post <a href="https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/">vb.net Bitmap object locks images (impossible to move/delete jpg/gif files) – .Dispose() Method common problem</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/vb-net-bitmap-object-locks-images-impossible-to-move-delete-jpg-gif-files-dispose-method-common-problem/">vb.net Bitmap object locks images (impossible to move/delete jpg/gif files) – .Dispose() Method common problem</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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[<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; 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></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/">How to draw a shadow for a bitmap (Drop Shadow Effect in VB.NET / ASP.NET)</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/how-to-draw-a-shadow-for-a-bitmap-drop-shadow-effect-in-vb-net-asp-net/">How to draw a shadow for a bitmap (Drop Shadow Effect in VB.NET / ASP.NET)</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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[<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 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></p>
<p>The post <a href="https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/">How to remove accent marks and german umlauts from URLs and Strings in .NET</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/how-to-remove-accent-marks-and-german-umlauts-from-urls-and-strings-in-vb-net-c-sharp/">How to remove accent marks and german umlauts from URLs and Strings in .NET</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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[<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; 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></p>
<p>The post <a href="https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/">Multilingual applications with VB.NET</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</p>]]></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><p>The post <a href="https://www.maxvergelli.com/developing-multilingual-applications-with-vb-net-c-sharp/">Multilingual applications with VB.NET</a> first appeared on <a href="https://www.maxvergelli.com">MaxVergelli.com</a>.</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>
	</channel>
</rss>
