TAILIEUCHUNG - Beginning Visual Basic 2005 phần 9

Sử dụng Visual Studio 2005 để thiết kế các ứng dụng của bạn cũng làm cho sự khác biệt lớn về năng suất. . NET Framework cung cấp hàng ngàn tên miền không gian, đối tượng, và điều khiển để sử dụng phát triển các ứng dụng Web Forms. Ngoài ra, cũng hỗ trợ tất cả các ngôn ngữ tương thích với NET | Chapter 19 Deleting Addresses To finish the functionality of your address book you ll deal with deleting items. When deleting items you must take into account that the item you are deleting is the last remaining item. In this case you ll have to provide the appropriate code to add a new blank address. This Try It Out will provide this and all necessary functionality to delete an address properly. Try It Out Deleting Addresses 1. Go back to the Form Designer for Forml and double-click the Delete button. Add this code to the event handler and also add the DeleteAddress method Private Sub btnDelete_Click ByVal sender As _ ByVal e As Handles ask the user if they are ok with this If MsgBox Are you sure you want to delete this address _ Or _ Then DeleteAddress CurrentAddressIndex End If End Sub DeleteAddress - delete an address from the list. Public Sub DeleteAddress ByVal index As Integer delete the item from the list. index - 1 was that the last address If 0 Then add a new address Else make sure you have something to show. If index Then index End If End If display the record. CurrentAddressIndex index End Sub 2. Run the project. You should be able to delete records from the address book. Note that if you delete the last record a new record will automatically be created. How It Works The algorithm you ve used here to delete the records is an example of how to solve another classic programming problem. Your application is set up so that it always has to display a record. That s why when the program is first run and there is no you automatically create a new record. Likewise when an item is deleted from the address book you have to find something to present to the user. To physically delete an address from the disk you use the RemoveAt

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.