473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Formatting DataBound Controls

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:
Expand|Select|Wrap|Line Numbers
  1. Me.lblShoeTypePrice.DataBindings.Add("text", Shoe_Type_DataTable, "Shoe_Price")
I'm not exactly sure how I should go about formatting the label so that it shows up as currency. The shoe price label will display a value like 4.0000 when I want it to be $4.00. The datatype for shoe price is currency in SQL Server 2005.

Right now I'm doing things like this:

Expand|Select|Wrap|Line Numbers
  1. Me.lblDailyCost.Text = FormatCurrency(Me.lblDailyCost.Text, 2)
I don't really like doing it that way since it could cause problems if there isn't a shoe type price.

I was wondering if formatting the datacolumn in the ShoeType DataTable to type currency would be best. Anyway...can anyone explain the common practice for this sort of thing? Thanks a ton!!
Apr 27 '07 #1
1 1307
...Not sure how to just edit a post..but

So i've been searching on this topic all day and refined my google search and came across a similar post here at thescripts.com. Changing 2 words around can do the trick I guess. I'm gonna go over this [HTML]http://www.thescripts.com/forum/thread379170.html[/HTML]
later, but if anyone has any quick advice I'd love to hear it. Thanks
Apr 27 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: DBQueen | last post by:
I have a subform which is in Continuous Forms view. I have added a button to the bottom of the page to move to the next record using the button wizard (result: DoCmd.GoToRecord , , acNext). I...
0
by: John Smith | last post by:
Hello all: Another day another problem :). How do you synch a databound combobox with the rest of the controls that are on a form. I have a combobox that lists a bunch of names and upon...
1
by: Johnny Liner | last post by:
Hello... I am creating a CurrencyManager object and setting it like this ... Code: Dim cm as CurrencyManager (...) 'On Open event of form cm = Me.BindingContext(ds,"tblPersonData")
7
by: Mark | last post by:
Hello. I am developing an Access 2000 form, and I want to populate a databound list box using a saved query that requires parameters. Is there any way to do this? I tried creating a DAO querydef...
5
by: clickon | last post by:
This is driving me nuts, it is such a simply thing to do but i cannot for the life of me work out how you are suposed to do it. I want to update the data in DropDownListB based on what is...
3
by: Jeff | last post by:
hey asp.net 2.0 I want to programmatically populate (with data from the database) a label control in a FormView on a webpage. Is it a good idea to put my logic inside the DataBound event of...
6
by: =?Utf-8?B?SnVzdGlu?= | last post by:
Hello: Does anyone know how I can create a multi-column listbox in VB.Net (Windows)...I am using VS.Net 2003. If there is another control available that can be databound with multiple...
0
by: morathm | last post by:
I have a windows client database management application written in C# that connects to remote web services to do all the heavy work. The thin-client app uses strong typed datasets, all maintained at...
6
by: Tomasz J | last post by:
Hello developers, I bind my TextBox control specyfying a format stored in my application global ApplicationContext object - it has a static string CurrencyFormat property. The problem - this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...
0
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,...

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.