Đang chuẩn bị liên kết để tải về tài liệu:
Locate Records with the DataTable Object

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

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 | 3.3 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 3.4. Figure 3.4. This combo box will point the user to a specific customer. Steps Open and run the VB.NET-Chapter 3 solution. From the main form click on the command button with the caption How-To 3.3. 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 3.4. Table 3.4. 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 .

TÀI LIỆU LIÊN QUAN