• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 178
  • Last Modified:

Formatting causes programing problems

I have used the data connection wizard to connect VB.NET to my Access database - the result is a success.  In the Access database I formated some values a currency but this formatting is not carried over to VB.NET.  So I formatted each text field so that it is formatted to display currency but now it will not write back to the database.  This is the code I used:

Private Sub editInitialOfferAmount_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editInitialOfferAmount.TextChanged
        Dim decInitialOfferAmount As Decimal

        Me.Label1.Text = editInitialOfferAmount.Text
        decInitialOfferAmount = Label1.Text

        Me.editInitialOfferAmount.Text = decInitialOfferAmount.ToString("C")
End Sub

Thanks in advance.
1 Solution
If your textboxes/labels are bound to your datatable, you would do better to use the Format and Parse functions to get the appearance that you want.  Here's a recent PAQ about that


When you change the actual database, you should reconfigure your dataadapter and recreate your typed datasets -if you have any.
This is a must because, when you create a dataadapter, it writes all the information of a field to your program (type, length, is auto increase, accepts null, etc)

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now