Beginning C# 2008 Databases From Novice to Professional phần 8

khi bạn kích đúp vào nút Submit Design view, bạn đang xem Mã, và mẫu btnSubmit_Click sự kiện tự động được tạo ra. Để đạt được các chức năng để kiểm soát này, bạn thêm đoạn mã sau: tin nhắn với tên đầu tiên và tên cuối cùng theo quy định của người sử dụng trong hộp tin nhắn, bạn áp dụng một phương pháp nối chuỗi trong khi viết mã. | CHAPTER 14 BUILDING WINDOWS FORMS APPLICATIONS 335 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 automatically gets generated. To achieve the functionality for this control you add the following code Hello Welcome to the Windows Application is a C method that pops up a message box. To display a Welcome message with the first name and last name specified by the user in the message box you apply a string concatenation approach while writing the code. In the code segment you hard code the message Hello Welcome to the Windows Application but with the first name and last name of the user appearing after the word Hello and concatenated with the rest of the message Welcome to the Windows Application . For readability you also add single space characters concatenated by instances of the operator in between the words and values you are reading from the Text property of the txtFnam and txtLname. If you do not include the single space character during string concatenation the words will be run into each other and the message displayed in the message box will be difficult to read. Setting Dock and Anchor Properties Prior to Visual Studio 2005 resizing Windows Forms would require you to reposition and or resize controls on those forms. For instance if you had some controls on the left side of a form and you tried to resize the form by stretching it toward the right side or bring it back toward the left the controls wouldn t readjust themselves according to the width of the resized form. Developers were bound to write code to shift controls accordingly .

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
13    132    1    13-05-2024
27    70    2    13-05-2024
251    76    1    13-05-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.