473,662 Members | 2,454 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Number Format..

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
Nov 20 '05 #1
14 1444
You only want to add a period to the end of your number
console.writeli ne(10 & ".")
????
You want it formatted with trailing zeros?
Console.WriteLi ne(FormatNumber (10, 2))
"Gary" <sp**@spam.co m> wrote in message
news:OD******** ******@tk2msftn gp13.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

Nov 20 '05 #2
* "Jared" <VB***********@ email.com> scripsit:
You only want to add a period to the end of your number
console.writeli ne(10 & ".")


But what if the number is variable and can be 10, 10.2, ...?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3
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******** ******@TK2MSFTN GP10.phx.gbl...
* "Jared" <VB***********@ email.com> scripsit:
You only want to add a period to the end of your number
console.writeli ne(10 & ".")


But what if the number is variable and can be 10, 10.2, ...?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>

Nov 20 '05 #4
Try this:

Dim str As String
Dim num As Int32 = 10
str = num.ToString("# " & "\.")
"Gary" <sp**@spam.co m> wrote in message
news:OD******** ******@tk2msftn gp13.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

Nov 20 '05 #5
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.super news.com...
Try this:

Dim str As String
Dim num As Int32 = 10
str = num.ToString("# " & "\.")
"Gary" <sp**@spam.co m> wrote in message
news:OD******** ******@tk2msftn gp13.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


Nov 20 '05 #6
"Gary" <sp**@spam.co m> wrote in message news:<OD******* *******@tk2msft ngp13.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(my Number, 2, , ,TriState.True)

Good luck...

A Hirsi
Nov 20 '05 #7
"Jared" <VB***********@ email.com> wrote in message news:<vu******* *****@corp.supe rnews.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******** ******@TK2MSFTN GP10.phx.gbl...
* "Jared" <VB***********@ email.com> scripsit:
You only want to add a period to the end of your number
console.writeli ne(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
Nov 20 '05 #8
* "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>
Nov 20 '05 #9
* "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>
Nov 20 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2932
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 comp? Martin # make cp Format.pm blib/lib/Number/Format.pm Manifying blib/man3/Number::Format.3pm
1
14374
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 Inventory..pc in %%i -fc:\bcp\bcp.fmt -T -S CHICKYy where CHICKYy is the server bcp.fmt
0
1878
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 fieldTypeCodes of 10 - 17. For any given query there will be up to 4 Extension nodes fitting this criteria. I have everything working except for being able to insert a, b, c or d in the <box12 tags. Notice each row or found node has a different letter. ...
2
5539
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 the result of this function, but am getting an ArgumentException : NumberGroupSizes error with the message "Parameter name: Every element in the value array should be between one and nine, except for the last, which can be zero" If I use just...
13
3143
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.
1
1491
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 pattern specification. In the msdn I found some samples like format-number(5351,"#,###"), but not a description of the format pattern.
5
3516
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 format of any country. I would like to be able to automatically display the information in the format of their country based on the information gathered from the Country field in the database. Is there any white paper, or book or site that has...
6
7352
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 2345-9341-0903-3432-343<b>1</b>) Does exist some algorithm for that... Thanks.
6
3675
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
10
13708
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 have tried to change the format with the following code, but it does not work. What is wrong with this code and how can I make that byte number field have the General Number format? Call...
0
8432
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8343
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8856
Oralloy
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7365
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1747
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.