7. In the Add New Item dialog box, name the Windows form NewEmpForm.vb.
CHAPTER 9 n ACTIVEX AND .NET 342
The Custom Task Pane Our custom task pane will contain two commands. The first will open
ourWindows form to collect new employee information. The second will send that information
to other departments who might need it.
1. Open the User Control Designer by double-clicking HRTaskPane.vb in the Solution
Explorer.
2. Click the Toolbox (on the left side of the Visual Studio window) to unhide it (if it??™s not
already displayed).
3. Click the pin (Auto Hide) button to leave the Toolbox displayed.
4. Add two Button controls from the Common Controls section (Figure 9-22) to the user
control by dragging them onto the Designer.
5. In the Properties pane, change the Text properties of the two buttons to New Employee
and E-mail Info, respectively, as shown in Figure 9-22.
6. In the Properties pane, name the New Employee button btnLaunch.
7. In the Properties pane, name the E-mail Info button btnEmail.
Figure 9-22. Completed HR task pane with Auto Hide command displayed
8. Double-click the New Employee button to open its code stub.
9. Add the following code to btnLaunch_Click:
Dim oForm As New NewEmpForm
oForm.ShowDialog()
This code creates a new instance of our NewEmpFormand opens it in dialog mode (so it
remains attached to the Excel window).
10. Click back on the HRTaskPane.vb [Design] tab, and then double-click the E-mail Info
button.
CHAPTER 9 n ACTIVEX AND .
Pages:
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314