Danh mục

Professional VB 2005 - 2006 phần 4

Số trang: 110      Loại file: pdf      Dung lượng: 5.47 MB      Lượt xem: 15      Lượt tải: 0    
Hoai.2512

Xem trước 10 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Nếu phương pháp này có một tài sản, bạn có thể khai báo nó như là một phần của giao diện bằng cách sử dụng từ khóa bất động sản: Bạn cũng có thể khai báo các sự kiện như là một phần của giao diện bằng cách sử dụng từ khóa sự kiệnĐể bao gồm một phương pháp như là một phần của giao diện của bạn, bạn chỉ đơn giản
Nội dung trích xuất từ tài liệu:
Professional VB 2005 - 2006 phần 4 Chapter 9 Globalimpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com System Wrox String System Integer String Text Text Web Book Figure 9-8 My The My keyword is a novel concept to quickly give you access to your application, your users, your resources, the computer, or the network on which the application resides. The My keyword has been referred to as a way of speed-dialing common but complicated resources that you need access to. Using the My keyword, you can quickly get access to a wide variety of items such as user details or specific settings of the requestor’s browser. Though not really considered a true namespace, the My object declarations that you make work the same as the .NET namespace structure you are used to working with. To give you an example, let’s first look at how you get at the user’s machine name using the traditional namespace structure: Environment.MachineName.ToString() For this example, you simply need to use the Environment class and use this namespace to get at the MachineName property. Now let’s look at how you would accomplish this same task using the new My keyword: My.Computer.Info.MachineName.ToString() As you are looking at this example, you might be wondering what the point is if the example, which is using My, is lengthier than the first example that just works off of the Environment namespace. Just remember that it really isn’t about the length of what you type to get access to specific classes, but instead is about a logical way to find often accessed resources without the need to spend too much time hunting them down. Would you have known to look in the Environment class to get the machine name of the user’s computer? Maybe, but maybe not. Using My.Computer.Info.MachineName.ToString() is a tremendously more logical approach, and once compiled, this namespace declaration will be set to work with the same class as previously without a performance hit. 298 Namespaces If you type the My keyword in your Windows Forms application, you will notice that IntelliSense provides you with six items to work with — Application, Computer, Forms, Resources, User, and WebServices. Though this new keyword works best in the Windows Forms environment, there are still things that you can use in the Web Forms world. If you are working for a Web application, then youimpo PDF Merge and Split Unregistered Version - http://www.simpopdf.com will have three items off of the My keyword — Application, Computer, and User. Each of these is broken down in the following sections. My.Application The My.Application namespace gives you quick access to specific settings and points that deal with your overall application. The following table details the properties and methods of the My.Application namespace. Property/Method Description Returns the contextual information about the thread of ApplicationContext the Windows Forms application. Provides quick access to the assembly of the Windows AssemblyInfo Forms. You can get at assembly information such as version number, name, title, copyright information, and more. A method that allows you to change the culture of the ChangeCurrentCulture current application thread. A method that allows you to change the culture that is ChangeCurrentUICulture being used by the Resource Manager. Returns the curr ...

Tài liệu được xem nhiều: