TAILIEUCHUNG - Mastering Microsoft Visual Basic 2008 phần 3

Có thể khởi tạo một mảng đa chiều với một tuyên bố duy nhất, cũng giống như bạn làm với một mảng một chiều. Bạn phải chèn dấu phẩy đủ trong dấu ngoặc đơn sau tên mảng để cho biết thứ hạng của mảng. Các báo cáo sau đây khởi tạo một mảng hai chiều và sau đó in một vài phần tử của nó: | THE LISTBOX CHECKEDLISTBOX AND COMBOBOX CONTROLS 195 There are a couple of things you should notice about this handler. First it doesn t react to the Enter key if it was pressed along with the Alt or Ctrl keys. The Shift key on the other hand is used to control the direction in the Tab order. The focus moves forward with the Enter keystroke and moves backward with the Shift Enter keystroke. Also the focus is handled automatically only for the TextBox CheckBox and DataTimePicker controls. When the user presses the Enter key when a button has the focus the program reacts as expected by invoking the button s Click event handler. The ListBox CheckedListBox and ComboBox Controls The ListBox CheckedListBox and ComboBox controls present lists of choices from which the user can select one or more. The first two are illustrated in Figure . FIGURE The ListBox and CheckedListBox controls The ListBox control occupies a user-specified amount of space on the form and is populated with a list of items. If the list of items is longer than can fit on the control a vertical scroll bar appears automatically. The CheckedListBox control is a variation of the ListBox control. It s identical to the ListBox control but a check box appears in front of each item. The user can select any number of items by selecting the check boxes in front of them. As you know you can also select multiple items from a ListBox control by pressing the Shift and Ctrl keys. The ComboBox control also contains multiple items but typically occupies less space on the screen. The ComboBox control is an expandable ListBox control The user can expand it to make a selection and collapse it after the selection is made. The real advantage of the ComboBox control however is that the user can enter new information in the ComboBox rather than being forced to select from the items listed. To add items at design time locate the Items property in the control s Properties window and click the ellipsis button. A new .

TỪ KHÓA LIÊN QUAN
Đã 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.