Tuesday, 6 July 2010

ListView Column AutoResize method in .Net Compact Framework

If your a .Net developer using the Compact Framework like me, you've no doubt been frustrated by the lack of some of the most basic functionality. I know it's meant to have a small footprint but some of the things they opt to leave out bewiders me sometimes!

For example, the .Net CF Listview does not have the AutoResize method on a column. This can be frustrating as to do this manually would be pretty intensive and just un-necessary. There is a solution though, the functionality is still there, it's just hidden away.

If you set the width of the column to be -1, it will resize the column to be the width of the longest item in that column. If you set the width of the column to be -2, it will resize the column to the width of the column heading text.

This is exactly the same as using listView.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent) and listView.Columns(0).AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize) on the full .Net framework.

Tuesday, 6 January 2009

Error in File UNKNOWN.RPT

We recently had a strange issue with Crystal Reports for .Net 2008 on our web server at work. We had three .net web applications that had been running fine for months then all of a sudden the following error message would be displayed whenever a Crystal Report was run:

Error in File UNKNOWN.RPT: The request could not be submitted for background processing.

After much reading around the web, changing of registry keys and uninstalling/re-installing the Crystal Reports for Visual Studio 2008 redistributable, the solution appeared to be something much more bizarre.

To resolve the issue we had to add the IIS guest user account (IUSR_SERVERNAME in our case) to the root of the C:\ drive in sharing and security. We left the default permissions and clicked apply. Voila! The reports were working again. Now obviously this is a pretty big security issue so we removed the user from the root of the C:\ drive and as if by magic the reports were still working! Go figure? Still I wasn't going to worry too much about it too much.