Hi,
I am trying to format a number to the following, "10" to "10." using,
Printline(1, format(10, "###.###)) naturally this does not achieve the
desired result, I know if I do this, Printline(1, format(10, "###.0##)) I
get this "10.0" but I do not need the trailing "0" any ideas on how to get
from this "10" to this "10."?
Thanks,
Gary 14 1426
You only want to add a period to the end of your number
console.writeline(10 & ".")
????
You want it formatted with trailing zeros?
Console.WriteLine(FormatNumber(10, 2))
"Gary" <sp**@spam.com> wrote in message
news:OD**************@tk2msftngp13.phx.gbl... Hi,
I am trying to format a number to the following, "10" to "10." using, Printline(1, format(10, "###.###)) naturally this does not achieve the desired result, I know if I do this, Printline(1, format(10, "###.0##)) I get this "10.0" but I do not need the trailing "0" any ideas on how to get from this "10" to this "10."?
Thanks,
Gary
* "Jared" <VB***********@email.com> scripsit: You only want to add a period to the end of your number console.writeline(10 & ".")
But what if the number is variable and can be 10, 10.2, ...?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
What is a variable?
Seems Herfried doesn't like me very much, he's been pretty picky about my
postings.
I would still appriciate any help from you, Thanks!
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ed**************@TK2MSFTNGP10.phx.gbl... * "Jared" <VB***********@email.com> scripsit: You only want to add a period to the end of your number console.writeline(10 & ".")
But what if the number is variable and can be 10, 10.2, ...?
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
Try this:
Dim str As String
Dim num As Int32 = 10
str = num.ToString("#" & "\.")
"Gary" <sp**@spam.com> wrote in message
news:OD**************@tk2msftngp13.phx.gbl... Hi,
I am trying to format a number to the following, "10" to "10." using, Printline(1, format(10, "###.###)) naturally this does not achieve the desired result, I know if I do this, Printline(1, format(10, "###.0##)) I get this "10.0" but I do not need the trailing "0" any ideas on how to get from this "10" to this "10."?
Thanks,
Gary
I have posted another way of maybe tackling the problem I have (see top of
subject listing)
Gary
"Brian" <no****@prairie.lakes.com> wrote in message
news:vu************@corp.supernews.com... Try this:
Dim str As String Dim num As Int32 = 10 str = num.ToString("#" & "\.")
"Gary" <sp**@spam.com> wrote in message news:OD**************@tk2msftngp13.phx.gbl... Hi,
I am trying to format a number to the following, "10" to "10." using, Printline(1, format(10, "###.###)) naturally this does not achieve the desired result, I know if I do this, Printline(1, format(10, "###.0##))
I get this "10.0" but I do not need the trailing "0" any ideas on how to
get from this "10" to this "10."?
Thanks,
Gary
"Gary" <sp**@spam.com> wrote in message news:<OD**************@tk2msftngp13.phx.gbl>... Hi,
I am trying to format a number to the following, "10" to "10." using, Printline(1, format(10, "###.###)) naturally this does not achieve the desired result, I know if I do this, Printline(1, format(10, "###.0##)) I get this "10.0" but I do not need the trailing "0" any ideas on how to get from this "10" to this "10."?
Thanks,
Gary
Gary:
Use the FormatNumber function...
From the Visual Basic Language Reference
Dim myNumber As Integer = 45600
Dim myString As String
' Returns "45,600.00".
myString = FormatNumber(myNumber, 2, , ,TriState.True)
Good luck...
A Hirsi
"Jared" <VB***********@email.com> wrote in message news:<vu************@corp.supernews.com>... What is a variable?
Seems Herfried doesn't like me very much, he's been pretty picky about my postings. I would still appriciate any help from you, Thanks!
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message news:ed**************@TK2MSFTNGP10.phx.gbl... * "Jared" <VB***********@email.com> scripsit: You only want to add a period to the end of your number console.writeline(10 & ".")
But what if the number is variable and can be 10, 10.2, ...?
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
Jared:
A variable is a temporary storage location whose value changes (varies).
dim myVar as integer
myVar = 10
myVar = 1000
There are also constants and many other abstract data types.
Relax.
I don't think anyone is picky with you. No one has monopoly to knowledge.
Read and learn as much as you can and be prepared to take each posting
as a learning opportunity.
Hirsi
* "Jared" <VB***********@email.com> scripsit: What is a variable?
I only wanted to add that your method will fail when used with a number
already containing a decimal point.
Seems Herfried doesn't like me very much, he's been pretty picky about my postings.
No... That's not true...
:-)
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
* "Brian" <no****@prairie.lakes.com> scripsit: Try this:
Dim str As String Dim num As Int32 = 10 str = num.ToString("#" & "\.")
This will work with integers, but it won't work with numbers like 2.3.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Yeah, I know that Herfried. That's why I used an Int32
and not a double.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OF**************@tk2msftngp13.phx.gbl... * "Brian" <no****@prairie.lakes.com> scripsit: Try this:
Dim str As String Dim num As Int32 = 10 str = num.ToString("#" & "\.")
This will work with integers, but it won't work with numbers like 2.3.
-- Herfried K. Wagner [MVP] <http://www.mvps.org/dotnet>
* "Brian" <no****@prairie.lakes.com> scripsit: Yeah, I know that Herfried. That's why I used an Int32 and not a double.
Just a little addition: I don't know the semantics of the ".", but if
it should be a decimal point, then I would not hardcode it. For example
on German systems, we use "," as separator.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Hi Herfried,
I saw this sentence now twice from you, I think it is better to change it a
little bit if you use it again, Just a little addition: I don't know the semantics of the ".", but if it should be a decimal point, then I would not hardcode it. For example on German systems, we use "," as separator.
In something as For example on the European Continent (but not only there)
we use "," as separator.
I think that is a little bit more international, now it looks something as
if only a minority as the German speaking people are using it.
:-)
Cor
* "Cor" <no*@non.com> scripsit: I saw this sentence now twice from you, I think it is better to change it a little bit if you use it again,
Just a little addition: I don't know the semantics of the ".", but if it should be a decimal point, then I would not hardcode it. For example on German systems, we use "," as separator.
In something as For example on the European Continent (but not only there) we use "," as separator.
I was not sure if all/most contries on the European Continent use this
convention.
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Yes I was not sure if all/most contries on the European Continent use this convention. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: martin.mrazek |
last post by:
Hello,
I wanted to install Number::Format module bud ended up with following
error message. Does anybody have any suggestion what the cause could
be?? Could that be due to presence of perldl in my...
|
by: Michelle Hillard |
last post by:
Hi guys, would appreciate if you can shed some light on this.
Sorry to be a pain, can you tell me what is wrong with the following:
for /F %%i in ('dir /b /on c:\bcp\pc*.txt') do bcp...
|
by: johkar |
last post by:
My XML and XSL is below. Also below is a textual representation of what I
want to get out of the XML with XSL. For each Extension node in XML, I am
only concerned with those nodes with...
|
by: Richard Haber |
last post by:
I am using format-number(-1234.56,'#,##0.00;(#,##0.00)') in a stylesheet
that works in every xsl processor (including MSXML2) except for the one in
..NET 1.1. I am expecting to see (1,234.56) as...
|
by: jm |
last post by:
I am trying to use datepart to get the real name of the month like
"April" or "APR" not just "4." I could not find it in the
documentation. Sorry. Thank you.
|
by: crowl |
last post by:
Hi all,
I want to have a number in a certain format. I took a look in the msdn
and was happy to find the format-number Function.
This works fine. But unfortunately, I can't find the format...
|
by: Kamaluokeakua |
last post by:
I have to write an application that deals with clients in multiple countries.
The addresses, phone numbers, country id and
currency information has to be stored into a database that allows for the...
|
by: Jovo Mirkovic |
last post by:
Hi,
I have to make a program which will generate 100,000 different ID
numbers (for example 2345-9341-0903-3432-3432 ...) It must be really
different, I meen it can not be a similar (like...
|
by: JFB |
last post by:
Hi all,
How can I format a fax number as 888-333-444?
The number is coming from database as 8883334444
<ItemTemplate>
<%#container.dataItem("cfax")%>
</ItemTemplate>
Tks
JFB
|
by: Dixie |
last post by:
I am appending some new fields to a table in vba and when I append a number
field with is a byte, it does not inherit any format. I want it to be the
General Number format, but it is blank. I...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |