TAILIEUCHUNG - Locate Records with the DataTable Object

Xác định vị trí Records với các đối tượng DataTable Sử dụng đối tượng DataTable, bạn có thể sử dụng đối tượng kia được gọi là các đối tượng DataRow cho phép bạn xác định vị trí một hàng cụ thể trong bảng dữ liệu. Điều này rất hữu ích khi bạn muốn người dùng hiện tại của bạn với một cơ chế tìm kiếm các hình thức của bạn | Locate Records with the DataTable Object Using the DataTable object you can use another object called the DataRow object that allows you to locate a specific row in the data table. This is useful when you want to present your users with a search mechanism for your form. This How-To shows you how to locate a specific row within your data table and how to use the same data table for two different purposes. After you have your DataTable object loaded in memory you want to be able to locate specific records within the DataTable object. How do you locate records in the DataTable object Technique For this How-To you are going to use a ComboBox control instead of a ListBox control. You will use the same technique for loading the combo box as you would the list box. The change comes when you select an item from the combo box. When an item is selected in the combo box the SelectedIndexChanged event is fired off. Within this event you will take the combo box s SelectedItem which gives the ValueMember that is located in the selected row and use that with the Find method off the DataTables Rows collection. With the data row located the corresponding columns are loaded into text boxes on the form as shown in Figure . Figure . This combo box will point the user to a specific customer. Steps Open and run the 3 solution. From the main form click on the command button with the caption How-To . When the form loads pick a new customer from the list that is presented in the customer ComboBox control. You will see the text boxes below the ComboBox control display new data that corresponds to the chosen customer. 1. Create a new Windows Form. 2. Add some labels combo boxes and text boxes as listed in Table . Table . Label TextBox and ComboBox Control Property Settings Object Property Setting Label Name Label 1 Caption Customer ComboBox Name cboCustomers Label Name Label2 Caption Customer ID Label Name Label3 Caption Company Name Label Name Label4 .

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.