December 21, 2007

TYPE_E_CANTLOADLIBRARY

Note to self: for error TYPE_E_CANTLOADLIBRARY (happens on Windows 2000)

Make sure the version of ASP.DLL in your system is 5.0.2195.6982

Another workaround is adding AspCompat="true" in your aspx page directive.

Share |

December 20, 2007

Calling COM object methods with extra parameters from C#

I am working on an ASP.NET app that is calling existing COM objects. A wrapper for the COM objects has been created using tlbimp, and that wrapper is referenced in my project.

One of the issues I am seeing is that the method signatures are occasionally different when calling the bridge in C# than in the sample classic ASP code that calls the same objects. One good example is with the Add method on VBA.Collection.

In classic ASP, you can simply call [class].[VBA.Collection].Add("mystring"). However, when calling the bridge in C#, the signature for this method shows up as [class].[VBA.Collection].Add(ref item, ref key, ref Before, ref After). No overloads, this is the only signature available. The actual parameter you want to use is the first one: "item", but what values/types do you pass for these parameters to make the equivalent call?

For the actual value you want to pass, you'll need to create a variable of type object to pass by ref into the first (item) parameter:

object item = "texttext";

for the other three, I tried passing various values, nulls, and types with no success, failing sometimes compile time, sometimes run time:

Exception from HRESULT: 0x800A0005 (CTL_E_ILLEGALFUNCTIONCALL)

the answer is to use System.Reflection.Missing.Value to represent the missing parameters. The called object will now use the default parameter values for key, Before, and After, and successfully add your item to the collection. Here's the code:

object m = System.Reflection.Missing.Value;
object name = "testtext";

oCOMClass.VBACollectionProperty.Add(ref name, ref m, ref m, ref m);

Share |

November 30, 2007

ASP.Net web application template missing from Visual Studio

I recently installed Visual Studio 2005 on a Virtual PC and opened an existing solution from Source Control and got an application type not supported error for one of the projects in the solution (it was an ASP.NET Web Application project). It seems to be a common problem, and a lot of people are able to easily resolve it by recreating the Project and Item template caches using the following command:

devenv /installvstemplates

Another possible cause for this issue could be that the templates are not in the right place - occasionally they are installed under My Documents.

To make sure they are in the right place, in VS go to Tools..Options..Projects and Solutions and make sure the project and item templates are in C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\. (that's where the above script will put them).

If you still have an issue you can download and install the VS 2005 Update to Support Web Application Projects here.

...after that File..New..Project should now show "ASP.NET Web Application" and "ASP.NET Web Service".

Share |

November 07, 2007

Floppy disk = SAVE

Right now I'm working on a SilverLight scheduling application for a 3-day event this January. I'm working on the "Save" functionality, where an attendee can store the itinerary of sessions they would like to sign up for. Most of the attendees for this conference are software engineers, architects and developers, probably familiar with the MS Office suite of applications where the Save button is a 12x12 pixel image of a floppy disk:

There is a lot of value in that image, since anyone who has used MS Office products, will intuitively recognize it as a save button, without a second thought. Lotus apps use the same symbol for saving, as well as many others. It's right up there with the red stop sign octagon, or the man/woman pictogram symbol on restroom doors when it comes to instant understanding of a graphic symbol.

But I'm sure there's a better visual representation of the Save function than something as obsolete as a 3.5" floppy - I mean I haven't had a floppy drive on my computer since 3 machines ago. Plus, why does a 3.5" floppy mean "Save" anyway?

The attendees for our conference are all familiar with software development, and one of the ubiquitous symbols in software application maps and network diagrams is the 3-D cylinder, which represents a database/datastore. So here's my thoughts on an equally intuitive Save icon.


For our application, that's exactly what we're doing - storing it in a database.

Another feature is the ability to email your itinerary to another attendee - again, "Email" functionality has been represented in multitudes of applications with the obvious envelope graphic, and that's such a simple, intuitive indicator that I wouldn't think of messing with that. We have a bit more graphical capabilities, so here's my treatment of Email functionality:

Share |

October 24, 2007

Moving Functoids & Links to new page

I had a complex map and wanted to make it easier to read by separating links and functoids into several pages within that map. BizTalk makes it extremely simple, but it took me a few minutes to get it...

1) Create a new destination page within the map.

2) Select the desired functoids and it's links from the old page.

3) Drag the functoid and links to the new destination page tab and keep holding the left mouse button down... you should see the arrow & grey box cursor... if you get the circle with the slash through it, you didn't correctly select all the functoids and links.

4) Now the new empty page is activated... but don't just drop the functoids on the tab, move the cursor back up into the grid, then drop them on the grid... they now are moved to the new page.

Share |