471,886 Members | 1,086 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,886 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 1257
...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

Post your reply

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

Similar topics

reply views Thread by John Smith | last post: by
3 posts views Thread by Jeff | last post: by
6 posts views Thread by =?Utf-8?B?SnVzdGlu?= | last post: by
6 posts views Thread by Tomasz J | last post: by
reply views Thread by zermasroor | last post: by

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.