Beginning microsoft Visual Basic 2010 phần 10

Trên Form1, rút ra một điều khiển ListBox. Thay đổi sở hữu IntegralHeight của nó là False, Dock tài sản của mình để Điền, và tên của nó để lstEmails, như thể hiện trong hình 19-7. Kích đúp vào thanh tiêu đề của hình thức. Thêm mã này để xử lý sự kiện Load. Hãy nhớ để thêm một tham chiếu đến và thêm khai báo không gian tên: | 614 I CHAPTER 19 VISUAL BASIC 2010 AND XML 2. On Forml draw a ListBox control. Change its IntegralHeight property to False its Dock property to Fill and its Name to IstEmails as shown in Figure 19-7. 3. Double-click the form s title bar. Add this code to thejoad event handler. Remember to add a reference to and add this namespace declaration Public Class Forml Private Sub Form1_Load ByVal sender As System. Object _ ByVal e As Handles where do we want to get the XML from. FIGURE 19-7 Dim filename As String _ C Users Bryan Documents Visual Studio 10 Projects Address Book bin Debug open the document. Dim reader As New XmlTextReader filename move to the start of the document. start working through the document. Dim addressData As Collection Nothing Dim elementName As String Nothing Do While what kind of node to we have Select Case is it the start of an element Case if it s an element start is it Address If Address Then if so create a new collection. addressData New Collection Else if not record the name of the element. elementName End If if we have some text try storing it in the collection. Case do we have an address If Not addressData Is Nothing Then elementName End If is it the end of an element Case if it is we should have an entire address stored. If Address Then try to create a new listview item. Dim item As String Nothing Try Prepared for STEPHEN EISEMAN email REISEMAN071@ Order number 55771330 This PDF is for the purchaser s personal . . 4-1 t T1 41 C M . d . T TO 1 4. . .J 4-1 1 1 4- 141 . J J 4- . 4-1 Integrating with the Address Book Application I 615 item addressData firstname _ addressData lastname item addressData email Catch End Try add the item to the list. item reset. addressData

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
68    116    5    05-07-2024
Đã 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.