473,698 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Formatting a label

Hi!

If I have a label that displays a price, and I want to apply formatting to
it ({0:C} for instance - displays the value as currency), how do I do that?
It seems like it is not possible.

What would then be the easiest and most correct way to make sure the
contents of the label is displayed in a certain way?

I know I could do some manual formatting , but I feel I must be missing
something obvious here.. :)

Thanks in advance

- Klaus


Nov 17 '05 #1
1 1086
And why exactly does the following not work: MyLabel.Text =
String.Format(" {0:C}", CurrencyValue); ?

Jerry

"Klaus Jensen" <msnews2@icatec h..dk> wrote in message
news:O%******** ********@TK2MSF TNGP10.phx.gbl. ..
Hi!

If I have a label that displays a price, and I want to apply formatting to
it ({0:C} for instance - displays the value as currency), how do I do that? It seems like it is not possible.

What would then be the easiest and most correct way to make sure the
contents of the label is displayed in a certain way?

I know I could do some manual formatting , but I feel I must be missing
something obvious here.. :)

Thanks in advance

- Klaus


Nov 17 '05 #2

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

Similar topics

7
3935
by: BBFrost | last post by:
I'm receiving decimal values from database queries and placing them on a report page. The users want to see the following .... Db Value Display Value 123.3400 123.34 123.0000 123 i.e. I want to trim trailing zeros and (decimal point if no decimal values
3
4980
by: Mervin Williams | last post by:
Can the text property be set inside the html using the String.Format() method? If not, is there some other means of setting the format for a label statically (not in code)? Thanks in advance, Mervin Williams
0
911
by: Jacob Crossley | last post by:
Please tell me there is a way to prevent this annoyance ; - ) I'm into writing perfectly indented html, but the .net dev environment is being overzealous and messing up my html formatting. for example, I originally write: <table> <tr> <td>
5
15959
by: Carla | last post by:
I have Access 2000. I made a mailing list database and for the life of me can't remember how to format the zip code field so it will print on the label as xxxxx-xxxx. I have tried various - 9, #, 0 - options but the "-" is not printing. It is running the numbers together. What am I doing wrong? I am using the label wizard and have the table set with zip code as a separate field.
14
4333
by: Scott M. | last post by:
Ok, this is driving me nuts... I am using VS.NET 2003 and trying to take an item out of a row in a loosely-typed dataset and place it in a label as a currency. As it is now, I am getting my unformatted data values (as decimals) just fine, so I know there's not a problem with the data retrieval, just the formatting. I have read that this would work: lblPrice.Text = prodRow.ToString("C");
7
1203
by: Mike | last post by:
I want to suppress blank lines in an address on a web page. At the moment, I am displaying the data like this: <asp:Label ID="Address1Label" runat="server" Text='<%# Eval("Address1")%>'></asp:Label><br /> <asp:Label ID="Address2Label" runat="server" Text='<%# Eval("Address2")%>'></asp:Label><br /> <asp:Label ID="Address3Label" runat="server" Text='<%# Eval("Address3") %>'></asp:Label><br />
1
1321
by: scoarescoare | last post by:
I am running into a problem that I cannot seem to solve. I'm using ADO.NET 2.0 with vb 2005. I have a dataset as a datasource that selects all of the Shoe_Types from a Shoe_Type table. I am creating the data set and doing all of the data binding at runtime. I then bind each label at run time by doing: Me.lblShoeTypePrice.DataBindings.Add("text", Shoe_Type_DataTable, "Shoe_Price") I'm not exactly sure how I should go about...
11
2429
nathj
by: nathj | last post by:
Hi, I am working on new version of a site that requires an application form for membership, this is so that certain features of the site are only available to members. The site is aimed at Church Leaders and requires a lot of information from them. I have two questions relating to form layout and formatting. 1) How do you remove the border from a text area? 2) How do you format an input text field to display a date format of dd/mm/ccyy?...
5
9359
by: Desitech | last post by:
I have a Label on a report with a check box from a table indicating True or False. I would like to have the labels that are true to highlight yellow using conditional foramtting. The False labels to remain unhighlighted. I have tried changing the label to a text box and then conditional formatting "Expresion Is" "BILL"=TRUE. But the formatting is not working. I loose my Label text and BackColor does not change. Any Suggestions?
0
9160
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
9029
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...
1
8897
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8862
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7729
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...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3050
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
3
2002
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.