When do DataColumn expressions get evaluated.

Firstly expressions columns store their values in the value like any other column and only evaluate in responce to certain events. So it is possible to look at a table an see data that doesn;t agree with the current value of the expression.
 
After much digging (Mostly by Jason) it turns out on add of a the row to the table and on EndEdit the row or of any dependent rows.
Posted in .Net Programing | Leave a comment

Formatting dates in VS2005 report projects

Just a note to me on date formating in Report projects.
 
=FormatDateTime(Fields!DateActiveFrom.Value ,2) will give short date.
I spent a little while trying to code it using the DateFormat enum but gave up and used the numeric index.
 
However if you will still need to set the Language on the report properties otherwise you still end up with the date in "Invariant" format
Posted in Uncategorized | 1 Comment

A note to me about ComboBoxes

A bound ComboBox with a datasource pointing to a non-existent column will return a datarowview for all rows instead of the expected value. In our envirnoment this can occur if "SetBindings" hasn’t been executed.
 
If you try and set .AutoCompleteMode before .AutoCompleteSource on a DropDownList you will get an exception and if this occurs during a form load event it may get eaten (I sort of got my head around why that occurrs). Anyway if it does the ComboBix starts to play poorly. No predictive text!
 
 
Posted in .Net Programing | Leave a comment

DataSet TableAdapterManager.UpdateAll Gotcha

I was sitting scratching my head as my app dutifully reported that I had edited data that needed to be saved, immediately after hitting the save button. All the tables had appropriate looking update and insert commands. The UpdateAll function was getting called. A quick check of the database confirmed that my enteries were not being saved.
 
Pretty obvious really but it still managed to bite me.
 
The TableAdapterManager provides a hierarchical update for a dataset via the UpdateAll function however you must set the its TableAdapter property for each table you wish to be updated. Forget to set one and that table simply does get updated. In our environment this entails creating a TableAccessor in the DataSet project.
 
 
Posted in Uncategorized | 3 Comments

Binding a Date Time Picker to a nullable date field

My first attempt was to create an infered boolean field to hold the null state of the date and bind this to the dtp’s checked property worked except it dirties the rows under some circumstances that I am yet to clearly identify. the work around has been to set the bindings to never update the data source (one-way binding) and handle the dtp’s validated event to update the row.
Posted in Uncategorized | Leave a comment

Dirty rows

VB .net application.
Multiple forms using bindingsources and bound comboboxes.
Endedit causes the current row to be marked as "changed" even though no data was changed.
 
After much hunting turns out I was setting the bindingsource.sort in formload to avoid type column names in unchecked strings in the designer. Turns out that because this form was being consumed by an MDI application that had already loaded the data, setting the sort appeared to cause the combobox bindings and only the comboboxes to write their selected values back to the dataset on endedit. I suspect this may have something to do with the way a bound combo box maintains its list by copying the data from the rows.
Posted in Uncategorized | Leave a comment

To blog or not to blog?

In the end the question like so many answered itself when the need became apparent. Yet again I fell into a coding pitfall that took me half a day to track down only to find I had been there before so I decided it was time to start a diary again! Diaries never worked for me, for starters I can barely read my own writing and I spend more time agonising over spelling and grammar then content and then it is never there for that critical thought that really was worth recording. Well I spend my working life and a fair bit of my un-working life wired, why not put it on on-line? Wait isn’t that a blog?

Ok I know you told me …

 
Posted in Uncategorized | 1 Comment