TAILIEUCHUNG - Add and Delete Records Using Bound Controls

1,5 Thêm và Xóa Records Sử dụng Bound Controls Bên cạnh đó dữ liệu chỉnh sửa, bổ sung thêm hồ sơ mới và xoá các bản ghi trong bảng là các tính năng rõ ràng là quan trọng. | Add and Delete Records Using Bound Controls Besides editing data adding new records and deleting records in a table are obviously important features. This How-To shows you just that taking advantage of the BinderContext class. Besides being able to edit current records that already exist users need to be able to add and delete records as well. How do you add and delete records using bound controls Technique To create the Add New Record feature you will add a button called btnAddNew that has code behind it. You will use the BindingContext object again to add a new record by using the AddNew method. A module variable will be added to the form to keep track of whether a record is being added or edited. If a new record is being added then when the update is performed the application needs to reload the data in the list box in case the new record s CompanyName data falls into the chosen list limit that is specified in the txtCustLimit text box. To create the Delete Record feature you will add a button called btnDelete. This button will have code behind it that will use the RemoveAt method of the ContextBinding object to remove the record from the dataset. The data will then be posted back to the server. Steps Open the solution for the chapter called VB .NET How-To Chapter 1 and run the application. From the main form click on the command button labeled How-To . Click the Load List button. Click the button labeled New. Enter the text ALF for Customer ID and Alfred s Fried Foods in the Company Name. Then click the button labeled Save and see the record you just entered added to the list. After the record has been entered you can test the delete feature by clicking on the button named Delete. The record goes away and the list is rebuilt. 1. Add a new command button under btnEdit and then set the Name property to btnNew and the Caption property to Save. 2. Add a new module-level variable called mbAddNew which is a Boolean variable to keep track of whether you are .

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.