Getting .NET Button ListBar control to work
Dave (DarkAngel) has responded to my call for help regarding the .NET Button ListBar Control and has kindly allowed me to post the solution here. Dave is the man really – he went through the trouble of grabbing the control, loading up VS.NET and working through it step by step with me in his email. All that for a stranger. I love you Dave!
The problem I had was trying to import the .NET Button ListBar Control into my VS.NET Toolbox. The instructions said to import the ButtonListBar.vb file into the project and it should work, but it doesn’t in Visual Studio.NET 2003. I think that is the reason it didn’t work (that it is VS.NET 2003 instead of just VS.NET).
Opening the ButtonListBar.vb file in the Designer threw out an error (see the call for help entry). Dave fixed that with this solution (also via email):
… move the region event argument classes to the end of the ButtonListBar.
He went on to help me compile the source files into a DLL, which I’m familiar with using for importing controls. Below are his instructions (slightly paraphrased). The credit goes solely to Dave (DarkAngel) – I’m merely reproducing it for the benefit of anyone who next comes across this problem.
- Open up Visual Studio .NET (Visual Studio .NET 2003 to be exact)
- Create a new project by clicking File -> New Project (I’m using Visual Basic, so I chose Visual Basic Project).
- Choose “Windows Control Library”.
- What we’ve done so far is just create a control library project which is ideal for putting new controls in. This will build to a DLL.
- Remove UserControl1.vb (the default file VS.NET creates) from the Solution Explorer (it’s unnecessary).
- Right click the project in the solution explorer and select Add -> Add existing item
- Add the ButtonListBar.vb file in the control source files downloaded.
- Build the project (choose to build for “Release”).
- The compiled DLL will then be in the bin/ directory of the project folder. You now have the ButtonListBar control in DLL form. All the remains is to add this control into the Toolbar of the project in which you want to use it.
Using the control:
- In the project you want to add the toolbar to, right-click your Toolbox and select “Add/Remove items”.
- Click “Browse” under the .net framework components tab.
- Browse to the location of the DLL we just created and double click it.
- Click OK to dismiss the Add/Remove items dialog.
- The ButtonListBar control should now be the bottom entry on your list. (You can right-click and sort alphabetically if you like).