Formatting causes programing problems

Posted on 2006-05-06
Last Modified: 2010-04-23
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.
Question by:tuck1996
    LVL 34

    Accepted 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

    LVL 9

    Expert Comment

    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

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    Suggested Solutions

    This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
    Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
    This video discusses moving either the default database or any database to a new volume.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    732 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now