Pregunta

I'm creating an add-in for Microsoft Excel that helps to automate some of my accounting processes. One of the pieces of the add-in is a ribbon tab with a button. Clicking this button opens a form with a list box that displays each account (worksheet) name and their respective balances.

The problem is that the rest of the controls in Excel are still tangible while the form is open. If, for example, a person were to change the name of the worksheet while the form was open, it may cause an error.

I noticed that message boxes render an application unclickable until they exit the screen. It isn't limited to just message boxes, either- I've seen the Nexus Mod Manager do the same thing when installing mods for games. I've seen it in many applications, but I haven't figured out how to do it myself.

My question is simple: how do I change the properties of a form such that the rest of the application is disabled until the form is closed?

¿Fue útil?

Solución

What you need is a modal form. Opening a modal form will "block" the entire UI until it is closed, just like message boxes do.

Have a look at http://msdn.microsoft.com/en-us/library/aa984358(v=vs.71).aspx

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top