1

Open XML – OLE Automation Date Issues

Posted by Tim on July 26, 2010 in .NET Framework, C#

If you are exporting a date from C# to Excel using 2007, you probably will use the following: Math.Round(DateTime.Now.ToOADate(), 12).ToString() This exports the date as a OLE Automation date recognized by Excel 2007. How ever, in Excel 2010 this was causing issues, every time I exported to Excel 2010, it said that it has to [...]

Tags: , , ,

 
0

Fixing the EF Tracing and Caching Provider Wrapper Issue

Posted by Tim on July 9, 2010 in .NET Framework, C#

If you have been using the Tracing and Caching Provider Wrappers for the ADO.NET Entity Framework 4.0, you might of come across this error message when creating POCO objects, adding them to a Data Context and commiting them to the database using the Caching Wrapper: [NotImplementedException: The method or operation is not implemented.] EFCachingProvider.EFCachingDataReaderCacheWriter.GetName(Int32 ordinal) [...]

Tags: , ,

 
0

Random number of items from a Generic List extension method

Posted by Tim on June 13, 2010 in .NET Framework, C#

Here is a code snippet  for returning N number of items from a generic list using a extension method.  This requires .NET 3.5. public static class Extensions     {         /// <summary>         /// method for returning N number of random items from a generic list     [...]

Tags: ,

 
1

The custom tool ‘MSLinqToSQLGenerator’ failed. Unspecified error

Posted by Tim on January 18, 2010 in .NET Framework, C#

I kept getting this error “The custom tool ‘MSLinqToSQLGenerator’ failed.  Unspecified error.   For me, this was caused when I was using partial classes and had several using statements at the top of the file: using System.Data.Linq; using System.Data.Linq.Mapping; using System.Data; using System.Collections.Generic; using System.Reflection; using System.Linq; using System.Linq.Expressions; using System.ComponentModel; using System; {namespace} {code} To [...]

Tags: , ,

 
0

Modify a Word 2007 Open XML document via C#

Posted by Tim on April 20, 2009 in .NET Framework, C#

Interesting problem that I came across here…A client requested that their system was to have the ability to load in a Word 2007 Document, perform some text manipulation routines and save the document back to the server. Firstly, you can rename a docx document to docx.zip and you can extract all of the files in [...]

Tags: , ,

 
0

Best Coding Practices – TIP 3

Posted by Tim on February 20, 2009 in .NET Framework, C#

The use of partial classes can help improve coding for the following reasons: As you can split code into seperate physical files, its easier to seperate UI and Business Logic that may belong in a single class Produces clean and organised code No performance hit… The compiler groups all partial classes into one entity during [...]

Tags: ,

 
0

Using ContextMenuStrip and NotifyIcon classes with WPF

Posted by Tim on February 10, 2009 in .NET Framework, C#

There are many ways to get a notification icon displaying in the system tray, this is how I managed to get it working using Windows Presentation Framework: public partial class ClassName : Window { private System.Windows.Forms.NotifyIcon m_notifyIcon; private System.Windows.Forms.ContextMenuStrip m_contextMenu; public ClassName() { InitializeComponent(); //Initalize the context menu strip m_contextMenu = new System.Windows.Forms.ContextMenuStrip(); System.Windows.Forms.ToolStripMenuItem mI1 [...]

Tags: ,

 
0

Creating a generic list of anonymous types

Posted by Tim on October 4, 2008 in .NET Framework, ASP.NET, C#

Scenerio I have a simple HTML form on a ASP.NET Web page. This form is to post a number of values including several elements that are compulsory to perform several actions on the server. As we know, when we post values to ASP.NET these are available for Request.Form. All we know is the key and [...]

Tags: , , , ,

 
0

Using Nested Functions in C#

Posted by Tim on September 7, 2008 in .NET Framework, C#

Scenario We currently have a templating API system where this allows developers to use a combination of C# and HTML markup to customized the display of the client’s websites. In this case, I needed a way to quickly perform some calculations and formatting without having to declare the function at design-time. My problem was I [...]

Tags: ,

Copyright © 2008-2010 Tim's CodeLab Blog All rights reserved.
Desk Mess Mirrored v1.7 theme from BuyNowShop.com.