Tuesday, June 3, 2008

Optional Parameters in C#.net

Hi,

Optional parameters are not supported in C#, so we have to pass a value to every parameter while calling a method. But incase, if we don't want to pass any value to the parameter, we can use the global variable defined as Type.Missing.

Check the following link of MSDN Site:
http://msdn.microsoft.com/hi-in/library/ms178843(en-us).aspx#ValueTypes

Thanks,
Vikas

How Add-ins Work with the 2007 Microsoft Office System

A very good explanation of Add-in architecture in the following library:

http://msdn.microsoft.com/hi-in/library/bb386298(en-us).aspx

Thanks,
Vikas

Sunday, June 1, 2008

IDTExtensilibity2 Procedure to Add Menus

Hi all,

I would describe the procedures/steps that is followed when you try to add menu through IDTExtensilibity2 Interface.

Whenever office application is opened, it checks whether it can find any DLL registered for the application or not. If it finds any DLL registered, that DLL is loaded in the memory. The DLL is a kind of ADD-In, which is loaded automatically. This process of loading the DLL File, triggers five types of events.
  • On connection
  • OnStartupComplete
  • OnDisconnection
  • OnBeginShutdown
  • OnAddInsUpdate


  • To capture these events, your DLL File must implement IDTExtensibility2 Interface. This interface contains the definition of all these events. One can write the code for adding menus in onstartupcomplete method. It will force the application to add Menus after it loads the Add In.

    Hope I was able to clear the process.

    Thanks,
    Vikas

    Wednesday, May 21, 2008

    ADO Connection Pooling Fundamentals

    If you require to open multiple connections several times in your application, it is not a good practice to open the connection every time it's needed because it involves overhead. For overcoming this problem, connection pooling is used. Whenver you close the connection, you mean to destroy the connection object because your work is already done. But, @ the backend, OLEDB preserves it's state in a pool. So whenver you will need the connection again, ADO will not have to do the expensive stuff again to make a connection to the source. Rather, it will pick the connection from the pool and will return the connection object.

    Please note that the connection pooling can only be achieved when the connection information is same. If you are opening a connection with a new ID/password, ADO will open a new connection to avoid security issues.

    Thanks,
    Vikas