Error: Cannot Change read Only Property For the Expression Column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • David Fúnez

    Error: Cannot Change read Only Property For the Expression Column

    Hi;

    I'm working with Component One FlexGrid DataGrid, i've added a calculated
    field [qty*price] to the DataGrid, when i press the Save Button an error
    message is displayed "Cannot Change read Only Property For the Expression
    Column" i press Enter and the Data is Saved even the Message "Data is Saved"
    is not shown.

    So i don't understand why it launches that error message if it saves the
    data anyway.

    *** The Form Load Code:
    Private Sub Form1_Load(ByVa l sender As System.Object, ByVal e As
    System.EventArg s) Handles MyBase.Load
    ' Here i add the column with the calculated field
    DsDeta1.Tables( 0).Columns.Add( "Sub Total", GetType(Double) , "qty *
    price")
    daDeta.Fill(DsD eta1)
    Flex.Cols(7).Fo rmat = "c"

    Flex.Subtotal(A ggregateEnum.Su m, 0, 0, 7, "Total")
    Flex.AllowEditi ng = False
    End Sub


    **** And this is the code for the Save button:
    Private Sub btnSave_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles btnSave.Click
    Try
    BindingContext( DsDeta1.Tables( 0)).CancelCurre ntEdit()
    daDeta.Update(D sDeta1.Tables(0 ))
    DsDeta1.Tables( 0).AcceptChange s()

    MsgBox("Data is Saved")

    Flex.AllowEditi ng = False

    Catch ex As Exception
    MsgBox("Error :" & ex.Message, MsgBoxStyle.Cri tical)
    End Try
    End Sub



    Any help.... Thanks on advance


    --
    David Fúnez
    Tegucigalpa, Honduras



  • Crouchie1998

    #2
    RE: Error: Cannot Change read Only Property For the Expression Column

    From what I see from the code you posted is that you don't allow any editing
    from the time the application is run.

    Behind your save button the message box will be shown as you aren't testing
    anything. Example:

    AllowChanges = False, but show that you have saved the changes - wrong

    The error message you are receiving isn't being caught in your try block.
    How is it possible to change a ReadOnly Property? You cannot because you
    aren't able to write to it. Maybe the changes are shown in the flexigrid, but
    not actually saving it.

    Comment

    Working...