Datagridview/Column/Expression property help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oceantrain
    New Member
    • Feb 2010
    • 11

    #1

    Datagridview/Column/Expression property help

    I have a datagridview with columns: [Rent] [Electric] [deposit] [amount paid]. I also have 2 other columns called [total due] and [balance due] (in that order across the grid).

    In the properties panel, in the expression property of the [amount paid] column, I entered this expression : [Rent]+[Electric]+[deposit]. This calculates these 3 columns and displays the sum in [amount paid] at runtime. It performs no problem. But when I hit the save button to save it to the database, I get this error:

    "The column mapping from SourceColumn 'Amount Paid' failed because the DataColumn 'Amount Paid' is a computed column."

    Finally, I also take the computed sum in [amount paid] and subtract it from the values that have been entered in [total due] and display the result in [balance due]. This also computes fine and I DO NOT get an error regarding the [balance due] column even though it is also a computed column. The error just gets thrown regarding [amount paid].

    Confused.

    Oceantrain.
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    Could you please post the code that you have for saving the data so that we can see what you're doing?

    -Frinny

    Comment

    • oceantrain
      New Member
      • Feb 2010
      • 11

      #3
      I set the expression property in the designer. I don't see the code for it in my solution. The best I can do is describe it in the previous post. Apologies.

      Comment

      Working...