Showing a winform in Excel is slow the first time

T

Torben Laursen

I have a COM shared add-in written in C# that I use in Excel.
One of the thinks that the user can do is to open some winforms.

The problem that I have is that the first time the user opens a winform it
is slow around 7 seconds and after that it takes no time.
Is there a way to speed up the process to show the winform the first time?

Thanks Torben
 
N

Nicholas Paldino [.NET/C# MVP]

Torben,

Is the showing of the form the first thing that is done when your COM
object is loaded? There are a few things that I can think of that are going
on here. The first is that the showing of the form is the first time your
COM object is referenced, and that causes the CLR to spool up, which is
going to have some overhead.

Also, if showing the form is the first operation that you are doing, is
there any initialization in the form, or in the add-in that could be
accounting for this?

Hope this helps.
 
T

Torben Laursen

Nicholas,

The forms are not shown until some time after the COM is loaded.
The COM is loaded and it adds a new menu item to Excel.
The user can then use this menu item to show some forms.
The forms has some code in the constructor but very little, like setting the
active tabpage.
The forms has some components on them mostly tabpages and radiogroups

Torben

Nicholas Paldino said:
Torben,

Is the showing of the form the first thing that is done when your COM
object is loaded? There are a few things that I can think of that are
going on here. The first is that the showing of the form is the first
time your COM object is referenced, and that causes the CLR to spool up,
which is going to have some overhead.

Also, if showing the form is the first operation that you are doing, is
there any initialization in the form, or in the add-in that could be
accounting for this?

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Torben Laursen said:
I have a COM shared add-in written in C# that I use in Excel.
One of the thinks that the user can do is to open some winforms.

The problem that I have is that the first time the user opens a winform
it is slow around 7 seconds and after that it takes no time.
Is there a way to speed up the process to show the winform the first
time?

Thanks Torben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top