tailieunhanh - Beginning Microsoft Visual Basic 2008 phần 6

Cuối cùng, chọn txtEdit trong combo box Class Name và sự kiện TextChanged trong hộp combo Tên Phương pháp ở trên cùng của trình biên tập mã. Thêm mã này: Private Sub txtEdit_TextChanged (ByVal người gửi Như Object, _ ByVal e Như | Chapter 12 Advanced Object-Oriented Techniques End If If the user can see us hide us If True Then False End Sub 11. Run the project and the icon will appear on the system tray. Right-click the icon and you ll see a list of favorites as was shown in Figure 12-7. Clicking one opens Internet Explorer clicking Exit closes the application. How It Works One thing to note is that because of the order of events that are fired for your form you have to create a variable in Forml called blnLoadCalled. This variable makes sure that your favorites get loaded in the form s Load event. The WebFavoriteMenuItem class accepts a WebFavorite object in its constructor and it configures itself as a menu item using the class. However this class provides a Click method that you can overload. So when the user selects the item from the menu you can immediately open the URL Private Sub WebFavoriteMenuItem_Click ByVal sender As Object _ ByVal e As Handles Open the favorite If Not Favorite Is Nothing Then End If End Sub The ExitMenuItem class does a similar thing. When this item is clicked you call the shared method to quit the program Private Sub ExitMenuItem_Click ByVal sender As Object _ ByVal e As Handles End Sub The important thing here is not the construction of the application itself but rather the fact that you can reuse the functionality you built in a different project. This underlines the fundamental motive for reuse it means you don t have to reinvent the wheel every time you want to do something. The method of reuse described here was to add the existing classes to your new project hence making a second copy of them. This isn t efficient because it takes double the amount of storage needed for the classes however the classes are small so the cost of memory is minimal. It did save you from having to create the classes from scratch allowing you to .

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.