ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Convert Number to string with Thousand Separator in C# and VB.Net<p>Hey <a class="username" rel="micah">micah</a>,</p> <p>Please refer below sample.</p> <p><span style="text-decoration: underline;"><strong>HTML</strong></span></p> <pre class="brush: html">&lt;div&gt; Inetger Amount: &lt;asp:Label ID=&#34;lblAmountInteger&#34; runat=&#34;server&#34; /&gt;&lt;br /&gt; Decimal Amount: &lt;asp:Label ID=&#34;lblAmountDecimal&#34; runat=&#34;server&#34; /&gt; &lt;/div&gt;</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">using System.Globalization; </pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Imports System.Globalization</pre> <p><span style="text-decoration: underline;"><strong>Code</strong></span></p> <p><strong>C#</strong></p> <pre class="brush: csharp">protected void Page_Load(object sender, EventArgs e) { int amountInInteger = 1200000; double amountIndecmal = 1200000.00; string amountInInetgerFormat = amountInInteger.ToString(&#34;#,##0&#34;);// for integer value string amountInDecimalFormat = amountIndecmal.ToString(&#34;N&#34;, new CultureInfo(&#34;en-US&#34;));// for decimal value lblAmountInteger.Text = amountInInetgerFormat; lblAmountDecimal.Text = amountInDecimalFormat; }</pre> <p><strong>VB.Net</strong></p> <pre class="brush: vb">Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load Dim amountInInteger As Integer = 1200000 Dim amountIndecmal As Double = 1200000.0 Dim amountInInetgerFormat As String = amountInInteger.ToString(&#34;#,##0&#34;) Dim amountInDecimalFormat As String = amountIndecmal.ToString(&#34;N&#34;, New CultureInfo(&#34;en-US&#34;)) lblAmountInteger.Text = amountInInetgerFormat lblAmountDecimal.Text = amountInDecimalFormat End Sub</pre> <p><span style="text-decoration: underline;"><strong>Namespaces</strong></span></p> <div>Inetger Amount: <span id="lblAmountInteger">1,200,000</span></div> <div>&nbsp;</div> <div>Decimal Amount: <span id="lblAmountDecimal">1,200,000.00</span></div>https://www.aspforums.net:443/Threads/756675/Convert-Number-to-string-with-Thousand-Separator-in-C-and-VBNet/https://www.aspforums.net:443/Threads/756675/Convert-Number-to-string-with-Thousand-Separator-in-C-and-VBNet/Tue, 27 Nov 2018 22:57:42 GMT