|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Why does dataset designer prevent expressions for New MyDataset.MyTable?I have created a dataset with two tables in it.One of those tables has an expression that calcs a percentage based on two other columns. However when i ran my app the UI was displaying (null) for the expression column. After digging into the code I realised the designer automatically prevents expressions from being loaded for a particular table if you declare an instance of the table rather than an instance of the dataset as below: <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Public Sub New() Me.New(false) End Sub <System.Diagnostics.DebuggerNonUserCodeAttribute()> _ Friend Sub New(ByVal initExpressions As Boolean) MyBase.New Me.TableName = "KPI" Me.BeginInit Me.InitClass If (initExpressions = true) Then Me.InitExpressions End If Me.EndInit End Sub So if i dim ds as new MyDataset then table column expressions are good to go but if i dim tbl as New MyDataset.MyDatatable then as per the designer generated constructor above; expressions will be disabled by default...... My question is why?? Why provide the ability to declaratively set expressions on table columns if Im just going to have to go ahead and reset them at runtime anyway? And more more importantly because Im now going to overrride this default behaviour what problems can i expect to encounter? Considering this is Microsoft we're talking about I can only assume there is a very good reason for the default behaviour.... as they only do anything for very good reasons....... right? Thanks alot Richard |
|||||||||||||||||||||||