Error: Cannot Change read Only Property For the Expression Column

  • Thread starter Thread starter David Fúnez
  • Start date Start date
D

David Fúnez

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(ByVal sender As System.Object, ByVal e As
System.EventArgs) 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(DsDeta1)
Flex.Cols(7).Format = "c"

Flex.Subtotal(AggregateEnum.Sum, 0, 0, 7, "Total")
Flex.AllowEditing = False
End Sub


**** And this is the code for the Save button:
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnSave.Click
Try
BindingContext(DsDeta1.Tables(0)).CancelCurrentEdit()
daDeta.Update(DsDeta1.Tables(0))
DsDeta1.Tables(0).AcceptChanges()

MsgBox("Data is Saved")

Flex.AllowEditing = False

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



Any help.... Thanks on advance
 
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.
 
Back
Top