Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. How to make DataColumn.Expression work?

How to make DataColumn.Expression work?

Scheduled Pinned Locked Moved C#
csswpfwcfgame-devtutorial
2 Posts 1 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Libra
    wrote on last edited by
    #1

    Had anybody found that DataColumn.Expression sometime is valid and sometime is invalid? If the DataTable which have a column define DataColumn.Expression binding a DataGrid which has a GridTableStyle, when your edit the grid and change the cloumn value which relation with the column has set 'Expression', the relation column MUST NOT calculate and display a new value. If I use DataTable.New to create a new DataRow and set value to the columns(not needn't set value to the column has set 'Expression'), and then use DataTable.Row.Add to add a new row, it sometimes can calculate and display a new value. But if I change the column's name and accordingly modify Expression's value, sometimes you surprise to found that it can not work, why? :confused::confused::confused: === Game is power! === -- modified at 23:24 Thursday 29th September, 2005

    L 1 Reply Last reply
    0
    • L Libra

      Had anybody found that DataColumn.Expression sometime is valid and sometime is invalid? If the DataTable which have a column define DataColumn.Expression binding a DataGrid which has a GridTableStyle, when your edit the grid and change the cloumn value which relation with the column has set 'Expression', the relation column MUST NOT calculate and display a new value. If I use DataTable.New to create a new DataRow and set value to the columns(not needn't set value to the column has set 'Expression'), and then use DataTable.Row.Add to add a new row, it sometimes can calculate and display a new value. But if I change the column's name and accordingly modify Expression's value, sometimes you surprise to found that it can not work, why? :confused::confused::confused: === Game is power! === -- modified at 23:24 Thursday 29th September, 2005

      L Offline
      L Offline
      Libra
      wrote on last edited by
      #2

      Haha..., I got the answer myself. If you write the sentence this.dataColumn.Expression="Col1 * Col2"; after ((System.ComponentModel.ISupportInitialize)(this.dataTable)).EndInit(); then it will work right. But if the code generate by IDE wizzard, it gererate the dataColumn code at the front part, and the sentence '(...).EndInit()' is generate at //Formxx part which must be generated at the end of mothed InitializeComponent(), so, the 'Expression' can not work. As the said, if you want to use 'DataCloumn.Express' property, the good way is written the code yourself after InitializeComponent(). :cool: === Game is power! === -- modified at 1:37 Friday 30th September, 2005

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups