TAILIEUCHUNG - Beginning microsoft Visual Basic 2010 phần 3

Đối với phần mềm để làm việc, bạn cần có một số dữ liệu để làm việc với. Phần mềm này sau đó mất dữ liệu và thao tác nó thành dạng khác. Ví dụ, phần mềm có thể mất cơ sở dữ liệu khách hàng của bạn, được lưu trữ như những người thân và số không trên ổ đĩa cứng máy tính của bạn, | 110 I CHAPTER 4 CONTROLLING THE FLOW Next End Sub 3. Run the project and click the Backwards for Next Loop button. You should see results like those shown in Figure 4-20. How It Works Let s review. If you use a negative number like -1 For tries to add -1 to the current control value. Adding a negative number has the effect of subtracting the number so intCount goes from its start value of 10 to its new value of 9 and so on until the stop value is reached. _ FIGURE 4-20 The For Each . Next Loop In practical day-to-day work it s unlikely that you ll use For . Next loops as illustrated here. Because of way the .NET Framework typically works you ll usually use a derivative of the For . Next loop called the For Each . . Next loop. In the algorithms you design whenever a loop is necessary you ll have a collection of things to work through and usually this set is expressed as an array. For example you might want to look through all of the files in a folder looking for those that are larger than a particular size. When you ask the .NET Framework for a list of files you are returned an array of strings with each string in that array describing a single file. TRY IT OUT For Each Loop In this Try It Out you ll modify your Loops application so that it returns a list of folders contained at the root of your C drive. 1. Return to the Forms Designer add another Button control to your form and set its Name property to btnForEachLoop and its Text property to For Each Loop. 2. Double-click the button and add the following bolded code to the Click event handler Private Sub btnForEachLoop_Click ByVal sender As _ ByVal e As Handles Clear the list ClearList List each folder at the root of your C drive For Each strFolder As String In _ C Add the item to the list strFolder Next End Sub Prepared for STEPHEN EISEMAN email REISEMAN071@ .

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.