OK, I am NOT trying to bait an argument here...I like both VB.Net and C#. I really do. I am totally comfortable in either of them. However, I am working on a project the needs me to work in C# and use Word Interop.
I am stunned to find this is actually much harder in C# than VB.net. Ironically, C# is usually a much less verbose (more concise?) language, but not in this case. If I want to open a word doc in VB.Net, it's a simple as:
Pretty easy.
C#? Not so easy....
That's a lot of code to open a doc! Also, the compiler does something strange. The underlined line in this last screenie goes away...once you build the project. However, if you do *anything* in the file (even adding a space) and the underlining comes back. The error it gives you is "Cannot create an instance of the abstract class or interface 'Microsoft.Office.Interop.Word.Application'
Just a little gotcha I spent a couple of hours "figuring out"... :-)
posted @ Monday, July 28, 2008 10:56 PM