Help with Word Add-in (Cancel button) c#

M

mypicturefaded

I have a signature add-in that I have created, and I am having trouble
making use of my forms, cancel buttons.
The add-in automatically goes to the next method in the project, so if
I use this.Close() it closes the form, but it just skips to the next
method anyway. When I hit cancel, I want the add-in to stop, and not
move to the next step. I also can't use Environment.Close() because it
shuts down Word completely.

Is there something I am missing? How is there a way around this?
Thanks in advance!
 
C

Cindy M.

Hi Mypicturefaded,
I have a signature add-in that I have created, and I am having trouble
making use of my forms, cancel buttons.
The add-in automatically goes to the next method in the project, so if
I use this.Close() it closes the form, but it just skips to the next
method anyway. When I hit cancel, I want the add-in to stop, and not
move to the next step. I also can't use Environment.Close() because it
shuts down Word completely.

I'm sure I've seen and responded to this same question sometime in
recent weeks...

Use some kind of "check" - whether a global variable or function or
something else - that each method references before executing. If it
returns a particular value, the method ends without executing. It should
all "fall through" quite quickly. You just want to be sure you properly
clean up anything connected to COM objects, otherwise you may be
"leaking".

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 

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