TAILIEUCHUNG - Wrox’s Visual Basic 2005 Express Edition Starter Kit phần 10

Đây là nơi mà các tính năng Thêm nhanh đến chơi. Cách nhấp chuột phải vào một lĩnh vực do đó cho phép bạn thay đổi cách thực hiện chương trình. Khi điều Go Wrong Tất cả các quy tắc và pháp luật liên quan đến bản quyền và thương hiệu | Answers to Exercises Private Sub btnGo_Click ByVal sender As _ ByVal e As Handles If IsNumeric Then vbNullString For Counter As Integer 1 To 100 Step CType Integer vbCrLf Next Else Sorry the increment you entered is not valid. End If End Sub 2. Run the application enter alphabetic characters in the Increment text box and click the Go button. Chapter 6 Exercises 1. Create an event handler for the New Person menu item that replicates the code you created for the New button on the Toolstrip. 2. Create an event in the PersonalDetails control that you can raise when the Save and Cancel buttons are clicked. Exercise 1 Solution 1. Because the event signatures are the same for the Toolstrip New button and the New Person Menuitem you can just change the Handles clause of the existing subroutine Private Sub newToolStripButton_Click ByVal sender As _ ByVal e As Handles _ If objPersonalDetails IsNot Nothing Then Personal Organizer End If End Sub Exercise 2 Solution 1. Define the event at the top of the code Public Event ButtonClicked ByVal iButtonType As Integer 2. Replace the MessageBox lines in the ButtonClickHandler routine to raise the event instead including an identifier that tells the event handler routine which button was clicked Private Sub ButtonClickedHandler ByVal sender As _ ByVal e As 323 Appendix C Dim btnSender As Button CType sender Button If btnSave Then RaiseEvent ButtonClicked l ElseIf btnCancel Then RaiseEvent ButtonClicked 2 End If End Sub 3. Change the definition of objPersonalDetails in the main form to include the WithEvents keyword Private WithEvents objPersonalDetails As PersonalDetails 4. Create an event .

TỪ KHÓA LIÊN QUAN
TÀI LIỆU MỚI ĐĂNG
Đã 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.