TAILIEUCHUNG - Visual Basic .NET I Didn't Know You Could Do That phần 3

Điều này có thể dẫn đến việc sử dụng các nguồn lực không hiệu quả, tuy nhiên. Hãy xem xét các đoạn mã sau đâyTrong đoạn mã này, một số chức năng ma thuật đi và kiểm tra nếu chương trình đã được đăng ký. Nếu không, sau đó một thể hiện của các hình thức đăng ký được khai báo và hiển thị. | 20 FROM VB6 TO prevent you from using object-oriented techniques and therefore not use the new language in the way in which it was intended. Furthermore having a Tag property on every single component can add up to a great deal of overhead. Do you really need a Tag property on every label and button on every form in your application Perhaps but probably not. Why have properties on controls that you ll never use In the long run it s better to run with stripped down versions of all the controls and use other tools to bolt new things on the side as you need them. This is a core component of object-oriented programming. To demonstrate the power of using object-oriented programming I ll take an existing component and bolt a few new properties onto it. In this example the goal is to load up a Treeview with a list of files on the machine s hard drive. When the user clicks one of the nodes in the Treeview I would like the program to display the date and size of that file. There are two basic ways I can solve this problem. The first way is to wait until the user clicks a file in the Treeview then go back to the file system to load the file date and time and display it. I decided this method might be a bit difficult to implement mainly because my Treeview node isn t going to have the filename with its complete path on each node. I would probably have to iterate through the parents of the node to reconstruct the full path of the file. Instead I decided that it would be much easier to store the date and time of each file somewhere as I was iterating through the file system and loading the file names into the Treeview. The only question was where to store these date and time variables. Since I needed a date and time variable for each file I was going to load into the Treeview it made sense to bolt these variables onto the TreeNode class as shown here Class FilePropertitesTreeNode Inherits TreeNode Private FFileDate As DateTime Private FFileSize As Long Property FileDate

TỪ KHÓA LIÊN QUAN
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.