If trying to format a value in a GridView with the following function
to be shown with thousand separators. If no value exists it should show
0.
If I send the value = 45000 it is still shown as 45000, not 45.000.
Why?
Function FormatAmount(ByVal value As Object) As String
'Show with thousand separator if not is null, else show 0
Dim strShow As String
If value Is DBNull.Value Then
strShow = "0"
Else
Dim dblAmount As Double = Convert.ToDouble(value)
strShow = Format("{0:#,##0}", dblAmount)
End If
Return strShow
End Function
Can someone please help me?
Regards,
S 3 2799
Use, strShow = String.Format("{0:#,##0}", dblAmount)
instead of, strShow = Format("{0:#,##0}", dblAmount)
if String.Format is not specified, Format function within Strings class is
used.
- Augustin
"st****@gmail.com" wrote:
If trying to format a value in a GridView with the following function
to be shown with thousand separators. If no value exists it should show
0.
If I send the value = 45000 it is still shown as 45000, not 45.000.
Why?
Function FormatAmount(ByVal value As Object) As String
'Show with thousand separator if not is null, else show 0
Dim strShow As String
If value Is DBNull.Value Then
strShow = "0"
Else
Dim dblAmount As Double = Convert.ToDouble(value)
strShow = Format("{0:#,##0}", dblAmount)
End If
Return strShow
End Function
Can someone please help me?
Regards,
S
This should help.. http://www.netomatix.com/development...ormatting.aspx
Try setting HtmlEncode="False" for your column.
<st****@gmail.comwrote in message
news:11********************@b28g2000cwb.googlegrou ps.com...
If trying to format a value in a GridView with the following function
to be shown with thousand separators. If no value exists it should show
0.
If I send the value = 45000 it is still shown as 45000, not 45.000.
Why?
Function FormatAmount(ByVal value As Object) As String
'Show with thousand separator if not is null, else show 0
Dim strShow As String
If value Is DBNull.Value Then
strShow = "0"
Else
Dim dblAmount As Double = Convert.ToDouble(value)
strShow = Format("{0:#,##0}", dblAmount)
End If
Return strShow
End Function
Can someone please help me?
Regards,
S
Try the .ToString() with formatting params, maybe without the 0: part.
<st****@gmail.comschreef in bericht
news:11********************@b28g2000cwb.googlegrou ps.com...
If trying to format a value in a GridView with the following function
to be shown with thousand separators. If no value exists it should show
0.
If I send the value = 45000 it is still shown as 45000, not 45.000.
Why?
Function FormatAmount(ByVal value As Object) As String
'Show with thousand separator if not is null, else show 0
Dim strShow As String
If value Is DBNull.Value Then
strShow = "0"
Else
Dim dblAmount As Double = Convert.ToDouble(value)
strShow = Format("{0:#,##0}", dblAmount)
End If
Return strShow
End Function
Can someone please help me?
Regards,
S This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Mike MacSween |
last post by:
This looks like a bug to me.
I have an expression on a report:
=Format(Sum((**)*(/)),"0.00")
Score is byte
PercentOfGrade is double
PropDegree is single
ModuleCats is byte
|
by: google |
last post by:
first, a little background...
i have a C program which preprocesses some data, and then outputs the
results into a text file. that text file, in turn, is used as input
to a FORTRAN...
|
by: raffelm |
last post by:
I'm struggling to find a way to include long path names in a command
line argument string that I have to build at runtime.
I need to create a string like -o:"c:\my documents\my file.txt".
...
|
by: Boz |
last post by:
Hi,
I am trying to use string.Format() to output the value of a double.
double da = 100000000000.99994;
double db = 100000000000.9994;
double dc = 100000000000.994;
double dd =...
|
by: Bob |
last post by:
I'm having trouble the string.Format() throwing exceptions and I can't figure
out what I am doing wrong.
Given the following setup code:
string str = { "one", "two", "three", "four" };
double...
|
by: ruca |
last post by:
Hi
I want to format some columns of my DataGrid control.
Example, one of my fields of DataSet is a DATE field and in BD he is Ok, but
when I show him in datagrid he comes with hours too. I...
|
by: ChinChin |
last post by:
Hi,
I have made a window application that get file information from the server the file size return in bytes. I need help on how to format the file size accordingly so that it will return the file...
|
by: Twayne |
last post by:
Hi,
Irrelevant question time, probably:
Is there any advantage/reason to use one format over the other for the
following two types of echo statements?
1. echo "error is " . $error;
2. ...
|
by: John B |
last post by:
Hi all,
Any idea why this code results in a FormatException?
DateTime.ParseExact("40708", "dMMyy", CultureInfo.CurrentCulture)
If I use "040708" with the same format string it works and it...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |