Đang chuẩn bị liên kết để tải về tài liệu:
Beginning VB 2008 Databases From Novice to Professional phần 8

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Đó là thời gian để thêm các chức năng và chuyển đổi quan điểm luật. Bạn đang để đọc trong các Tên đầu tiên và giá trị Tên cuối cung cấp bởi người sử dụng và đèn flash tin nhắn trên một nhấp chuột vào nút Submit, mà có nghĩa là bạn cần đặt tất cả các chức năng sau sự kiện | Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com CHAPTER 14 BUILDING WINDOWS FORMS APPLICATIONS 279 It s time to add functionality and switch the Code view. You are going to read in the First Name and Last Name values supplied by the user and flash a message on a click of the Submit button which means you need to put all the functionality behind the Submit button s click event which will eventually read the values from the TextBoxes. To achieve this continue with these steps 7. Double-click the Submit button. This will take you to Code view and you will see that the btnSubmit_Click event template has been added to the code editor window as shown in Figure 14-9. 8. Now add the following code inside this btnSubmit_Click event to achieve the desired functionality MessageBox.Show Hello txtFname.Text txtLname.Text Welcome to the Windows Application Welcome 9. Once you have added the code click Build Build Solution and ensure that the project gets build successfully. Figure 14-9. Code view of your Windows Forms Application project 10. Now it s time to run and test the application. To do so press Ctrl F5. Visual Studio 2008 will load the application. 11. Enter values in the First Name and Last Name text boxes and then click the Submit button you will see a message similar to the one shown in Figure 14-10. 12. Click OK and then close the Windows Application form. Simpo PDF Merge and Split Unregistered Version - http www.simpopdf.com 280 CHAPTER 14 BUILDING WINDOWS FORMS APPLICATIONS Figure 14-10. Running the Windows Application form How It Works Visual Studio comes with a lot of features to help developers while writing code. One of these features is that you can just double-click the GUI element for which you want to add the code and you will be taken to the code associated with the GUI element in Code view. For example when you double-click the Submit button in Design view you are taken to the Code view and the btnSubmit_Click event template .