Beginning Microsoft Visual Basic 2008 phần 3

Mở các dự án toán học nổi-điểm mà bạn đã tạo trước đó trong chương này. Mở trình soạn thảo luật cho Form1 và thực hiện những thay đổi sau đây: 'Thiết lập số lượng, số chia, và hiển thị kết quả dblNumber = 12 dblNumber / = 7' Hiển thị các kết quả mà không cần định dạng | Chapter 5 Working with Data Structures 3. Here s the problem The user doesn t know what 2 means. Close the project and find the following section of code at the end of the Hour property Set the display text At value 00 Richard is _ Currentstate End Set 4. Change the last line to read as follows Set the display text At value 00 Richard is _ End Set 5. Now run the project and you ll see something like Figure 5-9. Figure 5-9 How It Works As you typed the code you might have noticed that whenever you tried to set a value against Currentstate you were presented with an enumerated list of possibilities as shown in Figure 5-10. Determine the atatc If value 6 And value 7 Then CurrencStace I Tf value CurrentStat Eloclf value CurrentStat Eiself value uurrentstat Elself value CurrentStat Elaelf value lã ỉ ii DayAction-Atwork Í9 19 l ayArtinn R ia ingWrthFfienrtt J RayAftinn TravalingFrnmWnrlr Lal Figure 5-10 Visual Studio 2008 knows that Currentstate is of type DayAction. It also knows that DayAction is an enumeration and that it defines eight possible values each of which is displayed in the IntelliSense pop-up box. Clicking an item in the enumerated list causes a tooltip to be displayed with the actual value of the item for example clicking will display a tooltip with a value of 6. 151 Chapter 5 Working with Data Structures Fundamentally however because DayAction is based on an integer Currentstate is an integer value. That s why the first time you ran the project with the state determination code in place you saw an integer at the end of the status string. At 7 . you know that Richard is traveling to work or rather Currentstate equals . You defined this as 2 which is why 2 is displayed at the end of the string. What you ve done in .

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
5    111    2    02-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.