Khi bạn đang viết Visual Basic 2005 ứng dụng, một giải pháp có thể bao gồm nhiều dự án. Tại thời điểm này, bạn có một dự án trong giải pháp: ứng dụng phần mềm xem yêu thích. Trong thử nó ra, bạn thêm một dự án Thư viện lớp để giải pháp này và sau đó di chuyển các lớp học từ các dự án ứng dụng Windows dự án Thư viện lớp. | Chapter 12 Building a Class Library for Favorites Viewer When you re writing Visual Basic 2005 applications a solution can contain multiple projects. At the moment you have one project in the solution the Favorites Viewer application. In the next Try It Out you add a Class Library project to this solution and then move the classes from the Windows Application project to the Class Library project. Try It Out Adding a Class Library Project to an Existing Solution 1. Switch to the InternetFavorites project. 2. Save the project and then close Visual Studio 2005. 3. Open the Favorites Viewer project. 4. Click the File menu and select Add o Existing Project. 5. Navigate to the where you saved your InternetFavorites solution and then select the Internet file. Click Open to add this project to the solution. 6. Right-click the Favorites Viewer project in the Solution Explorer and select Set As Startup Project. 7. Now right-click the Favorites Tray project in the Solution Explorer and select Remove. How It Works Now you have two projects within your solution. You have a Windows application and a class library. Currently the class library is empty all the classes that you want to add to the class library are in the Windows application project. You have already seen how to add a new class to a Windows application and you can add new classes to a class library in exactly the same way. You just right-click the internetFavorites project and select Add o Class. You don t want to do that though because the classes already exist. The quickest way to move a class between two projects in the same solution is to drag and drop them which is what you do in the next Try It Out. Try It Out Moving Classes Between Projects 1. Select the file in the Solution Explorer as shown in Figure 12-2 and drag it onto the InternetFavorites project. This causes a copy of the Favorites class to be added to the InternetFavorites project. Figure 12-2 386 Building Class .