Formatting DataBound Controls

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scoarescoare
    New Member
    • Apr 2007
    • 5

    #1

    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:
    Code:
    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:

    Code:
    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!!
  • scoarescoare
    New Member
    • Apr 2007
    • 5

    #2
    ...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.ht ml[/HTML]
    later, but if anyone has any quick advice I'd love to hear it. Thanks

    Comment

    Working...