Rajan / Herman / Jones | Visual Basic 2008 Recipes | E-Book | www.sack.de
E-Book

E-Book, Englisch, 704 Seiten

Rajan / Herman / Jones Visual Basic 2008 Recipes

A Problem-Solution Approach
1. ed
ISBN: 978-1-4302-0604-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

A Problem-Solution Approach

E-Book, Englisch, 704 Seiten

ISBN: 978-1-4302-0604-0
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



Visual Basic 2008 Recipes is a book of ready-made coding solutions for programmers who don't want spend a lot of time reading. Each chapter addresses a specific problem-domain such as multimedia, database access, XML manipulation, etc. Each chapter then presents a number of common problems, with a solution following each problem. Readers appreciate the recipe format, because they can look up a problem, read one to three pages, implement the solution, and then get on with their work. Recipe books are ideal for those who want to spend their days doing, not reading.

Rakesh Rajan was a Microsoft 'Most Valuable Professional' in C# and an MCSD in .NET from the Bangalore, India area. He worked as a software engineer in the U.S. at Trivandrum. Rakesh passed away in 2006.

Rajan / Herman / Jones Visual Basic 2008 Recipes jetzt bestellen!

Weitere Infos & Material


1;Contents at a Glance;5
2;Contents;6
3;About the Author;13
4;About the Technical Reviewer;14
5;Acknowledgments;15
6;Introduction;16
7;Application Development;17
7.1;1-1. Create a Console Application from the Command Line;18
7.2;1-2. Create a Windows- Based Application from the Command Line;21
7.3;1-3. Create and Use a Code Module from the Command Line;24
7.4;1-4. Create and Use a Code Library from the Command Line;26
7.5;1-5. Embed a Resource File in an Assembly;27
7.6;1-6. Build Projects from the Command Line Using MSBuild.exe;30
7.7;1-7. Access Command-Line Arguments;33
7.8;1-8. Include Code Selectively at Build Time;35
7.9;1-9. Manipulate the Appearance of the Console;39
7.10;1-10. Access a Program Element That Has the Same Name As a Keyword;41
7.11;1-11. Create and Manage Strong-Named Key Pairs;42
7.12;1-12. Give an Assembly a Strong Name;43
7.13;1-13. Verify That a Strong-Named Assembly Has Not Been Modified;46
7.14;1-14. Delay Sign an Assembly;47
7.15;1-15. Sign an Assembly with an Authenticode Digital Signature;48
7.16;1-16. Create and Trust a Test Software Publisher Certificate;53
7.17;1-17. Manage the Global Assembly Cache;54
7.18;1-18. Make Your Assembly More Difficult to Decompile;55
7.19;1-19. Use Implicitly Typed Variables;56
7.20;1-20. Use Object Initializers;57
7.21;1-21. Use Anonymous Types;60
7.22;1-22. Create and Use Extension Methods;61
7.23;1-23. Create and Use Lambda Expressions;63
8;Data Manipulation;67
8.1;2-1. Manipulate the Contents of a String Efficiently;67
8.2;2-2. Encode a String Using Alternate Character Encoding;70
8.3;2-3. Convert Basic Value Types to Byte Arrays;72
8.4;2-4. Base64 Encode Binary Data;75
8.5;2-5. Validate Input Using Regular Expressions;78
8.6;2-6. Use Compiled Regular Expressions;81
8.7;2-7. Create Dates and Times from Strings;84
8.8;2-8. Add, Subtract, and Compare Dates and Times;86
8.9;2-9. Convert Dates and Times Across Time Zones;89
8.10;2-10. Sort an Array or an ArrayList;93
8.11;2-11. Copy a Collection to an Array;95
8.12;2-12. Manipulate or Evaluate the Contents of an Array;96
8.13;2-13. Use a Strongly Typed Collection;100
8.14;2-14. Create a Generic Type;102
8.15;2-15. Store a Serializable Object to a File;105
8.16;2-16. Read User Input from the Console;108
9;Application Domains, Reflection, and Metadata;112
9.1;3-1. Load an Assembly into the Current Application Domain;113
9.2;3-2. Create an Application Domain;115
9.3;3-3. Execute an Assembly in a Different Application Domain;117
9.4;3-4. Avoid Loading Unnecessary Assemblies into Application Domains;119
9.5;3-5. Create a Type That Cannot Cross Application Domain Boundaries;120
9.6;3-6. Create a Type That Can Be Passed Across Application Domain Boundaries;121
9.7;3-7. Instantiate a Type in a Different Application Domain;124
9.8;3-8. Pass Data Between Application Domains;128
9.9;3-9. Unload Assemblies and Application Domains;130
9.10;3-10. Retrieve Type Information;131
9.11;3-11. Test an Object’s Type;134
9.12;3-12. Instantiate an Object Using Reflection;136
9.13;3-13. Create a Custom Attribute;139
9.14;3-14. Inspect the Attributes of a Program Element Using Reflection;142
10;Threads, Processes, and Synchronization;144
10.1;4-1. Execute a Method Using the Thread Pool;145
10.2;4-2. Execute a Method Asynchronously;148
10.3;4-3. Creating an Asynchronous Method to Update the User Interface;155
10.4;4-4. Execute a Method Periodically;160
10.5;4-5. Execute a Method at a Specific Time;162
10.6;4-6. Execute a Method by Signaling a WaitHandle Object;165
10.7;4-7. Execute a Method Using a New Thread;167
10.8;4-8. Synchronize the Execution of Multiple Threads Using a Monitor;169
10.9;4-9. Synchronize the Execution of Multiple Threads Using an Event;174
10.10;4-10. Synchronize the Execution of Multiple Threads Using a Mutex;178
10.11;4-11. Synchronize the Execution of Multiple Threads Using a Semaphore;180
10.12;4-12. Synchronize Access to a Shared Data Value;182
10.13;4-13. Know When a Thread Finishes;184
10.14;4-14. Terminate the Execution of a Thread;186
10.15;4-15. Create a Thread-Safe Collection Instance;188
10.16;4-16. Start a New Process;189
10.17;4-17. Terminate a Process;192
10.18;4-18. Ensure That Only One Instance of an Application Can Execute Concurrently;194
11;Files, Directories, and I/O;197
11.1;5-1. Retrieve Information About a File, Directory, or Drive;198
11.2;5-2. Set File and Directory Attributes;203
11.3;5-3. Copy, Move, or Delete a File or a Directory;204
11.4;5-4. Calculate the Size of a Directory;208
11.5;5-5. Retrieve Version Information for a File;210
11.6;5-6. Show a Just-in-Time Directory Tree in the TreeView Control;211
11.7;5-7. Read and Write a Text File;214
11.8;5-8. Read and Write a Binary File;217
11.9;5-9. Parse a Delimited Text File;218
11.10;5-10. Read a File Asynchronously;222
11.11;5-11. Find Files That Match a Wildcard Expression;225
11.12;5-12. Test Two Files for Equality;226
11.13;5-13. Manipulate Strings Representing File Names;228
11.14;5-14. Determine Whether a Path Is a Directory or a File;229
11.15;5-15. Work with Relative Paths;230
11.16;5-16. Create a Temporary File;232
11.17;5-17. Get the Total Free Space on a Drive;233
11.18;5-18. Show the Common File Dialog Boxes;235
11.19;5-19. Use an Isolated Store;237
11.20;5-20. Monitor the File System for Changes;239
11.21;5-21. Access a COM Port;242
11.22;5-22. Get a Random File Name;243
11.23;5-23. Manipulate the Access Control Lists of a File or Directory;243
12;Language Integrated Query (LINQ);247
12.1;6-1. Query a Generic Collection;248
12.2;6-2. Query a Nongeneric Collection;250
12.3;6-3. Control Query Results;251
12.4;6-4. Sort Data Using LINQ;253
12.5;6-5. Filter Data Using LINQ;254
12.6;6-6. Perform General Aggregate Operations;256
12.7;6-7. Perform Average and Sum Calculations;257
12.8;6-8. Perform Count Operations;259
12.9;6-9. Perform Min and Max Calculations;260
12.10;6-10. Group Query Results;262
12.11;6-11. Query Data from Multiple Collections;264
12.12;6-12. Returning Specific Elements of a Collection;267
12.13;6-13. Display Collection Data Using Paging;268
12.14;6-14. Compare and Combine Collections;270
12.15;6-15. Cast a Collection to a Specific Type;273
13;LINQ to XML and XML Processing;276
13.1;7-1. Create an XML Document;277
13.2;7-2. Load an XML File into Memory;281
13.3;7-3. Insert Elements into an XML Document;282
13.4;7-4. Change the Value of an Element or Attribute;284
13.5;7-5. Remove or Replace Elements or Attributes;285
13.6;7-6. Query an XML Document Using LINQ;287
13.7;7-7. Query for Elements in a Specific XML Namespace;289
13.8;7-8. Query an XML Document Using XPath;291
13.9;7-9. Join and Query Multiple XML Documents;293
13.10;7-10. Convert an XML File to a Delimited File ( and Vice Versa);294
13.11;7-11. Validate an XML Document Against a Schema;298
13.12;7-12. Use XML Serialization with Custom Objects;303
13.13;7-13. Create a Schema for a .NET Class;306
13.14;7-14. Generate a Class from a Schema;307
13.15;7-15. Perform an XSL Transform;308
14;Database Access;312
14.1;8-1. Connect to a Database;314
14.2;8-2. Use Connection Pooling;317
14.3;8-3. Create a Database Connection String Programmatically;319
14.4;8-4. Store a Database Connection String Securely;321
14.5;8-5. Execute a SQL Command or Stored Procedure;324
14.6;8-6. Use Parameters in a SQL Command or Stored Procedure;329
14.7;8-7. Process the Results of a SQL Query Using a Data Reader;333
14.8;8-8. Obtain an XML Document from a SQL Server Query;336
14.9;8-9. Perform Asynchronous Database Operations Against SQL Server;340
14.10;8-10. Write Database-Independent Code;343
14.11;8-11. Create a Database Object Model;347
14.12;8-12. Generate Data Object Classes from the Command Line;351
14.13;8-13. Discover All Instances of SQL Server on Your Network;353
15;Windows Forms;355
15.1;9-1. Add a Control Programmatically;356
15.2;9-2. Link Data to a Control;359
15.3;9-3. Process All the Controls on a Form;360
15.4;9-4. Track the Visible Forms in an Application;362
15.5;9-5. Find All MDI Child Forms;364
15.6;9-6. Save Configuration Settings for a Form;367
15.7;9-7. Force a List Box to Scroll to the Most Recently Added Item;370
15.8;9-8. Restrict a Text Box to Accepting Only Specific Input;371
15.9;9-9. Use an Autocomplete Combo Box;374
15.10;9-10. Sort a List View by Any Column;376
15.11;9-11. Lay Out Controls Automatically;380
15.12;9-12. Make a Multilingual Form;381
15.13;9-13. Create a Form That Cannot Be Moved;384
15.14;9-14. Make a Borderless Form Movable;385
15.15;9-15. Create an Animated System Tray Icon;388
15.16;9-16. Validate an Input Control;389
15.17;9-17. Use a Drag-and-Drop Operation;391
15.18;9-18. Use Context-Sensitive Help;393
15.19;9-19. Display a Web Page in a Windows-Based Application;394
15.20;9-20. Create a Windows Presentation Foundation Application;397
15.21;9-21. Run a Windows Vista Application with Elevated Rights;399
16;Multimedia;402
16.1;10-1. Find All Installed Fonts;403
16.2;10-2. Perform Hit Testing with Shapes;405
16.3;10-3. Create an Irregularly Shaped Control;408
16.4;10-4. Create a Movable Sprite;410
16.5;10-5. Create a Scrollable Image;414
16.6;10-6. Perform a Screen Capture;416
16.7;10-7. Use Double Buffering to Increase Redraw Speed;418
16.8;10-8. Show a Thumbnail for an Image;420
16.9;10-9. Play a Simple Beep or System Sound;421
16.10;10-10. Play a WAV File;423
16.11;10-11. Play a Sound File;424
16.12;10-12. Show a Video with DirectShow;426
16.13;10-13. Retrieve Information About Installed Printers;429
16.14;10-14. Print a Simple Document;431
16.15;10-15. Print a Multipage Document;434
16.16;10-16. Print Wrapped Text;437
16.17;10-17. Show a Dynamic Print Preview;439
16.18;10-18. Manage Print Jobs;442
17;Networking and Remoting;447
17.1;11-1. Obtain Information About the Local Network Interface;448
17.2;11-2. Detect Changes in Network Connectivity;451
17.3;11-3. Download Data over HTTP or FTP;453
17.4;11-4. Download a File and Process It Using a Stream;456
17.5;11-5. Respond to HTTP Requests from Your Application;458
17.6;11- 6. Get an HTML Page from a Site That Requires Authentication;462
17.7;11-7. Send E-mail Using SMTP;465
17.8;11-8. Resolve a Host Name to an IP Address;468
17.9;11-9. Ping an IP Address;470
17.10;11-10. Communicate Using TCP;472
17.11;11-11. Create a Multithreaded TCP Server That Supports Asynchronous Communications;476
17.12;11-12. Communicate Using UDP;484
17.13;11-13. Communicate Using Named Pipes;487
17.14;11-14. Make an Object Remotable;491
17.15;11-15. Register All the Remotable Classes in an Assembly;496
17.16;11-16. Host a Remote Object in IIS;498
17.17;11-17. Control the Lifetime of a Remote Object;499
17.18;11-18. Control Versioning for Remote Objects;501
17.19;11-19. Consume an RSS Feed;503
18;Security and Cryptography;505
18.1;12-1. Allow Partially Trusted Code to Use Your Strong-Named Assembly;506
18.2;12-2. Disable Execution Permission Checks;508
18.3;12-3. Ensure the Runtime Grants Specific Permissions to Your Assembly;510
18.4;12-4. Limit the Permissions Granted to Your Assembly;512
18.5;12-5. View the Permissions Required by an Assembly;513
18.6;12-6. Determine at Runtime Whether Your Code Has a Specific Permission;515
18.7;12-7. Restrict Who Can Extend Your Classes and Override Class Members;516
18.8;12-8. Inspect an Assembly’s Evidence;518
18.9;12-9. Determine Whether the Current User Is a Member of a Specific Windows Group;521
18.10;12-10. Restrict Which Users Can Execute Your Code;524
18.11;12-11. Impersonate a Windows User;527
18.12;12-12. Create a Cryptographically Random Number;531
18.13;12-13. Calculate the Hash Code of a Password;532
18.14;12-14. Calculate the Hash Code of a File;536
18.15;12-15. Verify a Hash Code;538
18.16;12-16. Ensure Data Integrity Using a Keyed Hash Code;540
18.17;12-17. Work with Security-Sensitive Strings in Memory;543
18.18;12-18. Encrypt and Decrypt Data Using the Data Protection API;546
19;Code Interoperability;549
19.1;13-1. Call a Function in an Unmanaged DLL;550
19.2;13-2. Get the Handle for a Control, Window, or File;553
19.3;13-3. Call an Unmanaged Function That Uses a Structure;555
19.4;13-4. Call an Unmanaged Function That Uses a Callback;558
19.5;13-5. Retrieve Unmanaged Error Information;559
19.6;13-6. Use a COM Component in a .NET Client;561
19.7;13-7. Release a COM Component Quickly;563
19.8;13-8. Use Optional Parameters;564
19.9;13-9. Use an ActiveX Control in a .NET Client;566
19.10;13-10. Expose a .NET Component to COM;568
19.11;13-11. Use a Windows Presentation Foundation Control from a Windows Form;569
20;Commonly Used Interfaces and Patterns;571
20.1;14-1. Implement a Serializable Type;571
20.2;14-2. Implement a Cloneable Type;577
20.3;14-3. Implement a Comparable Type;581
20.4;14-4. Implement an Enumerable Type Using a Custom Iterator;585
20.5;14-5. Implement a Disposable Class;592
20.6;14-6. Implement a Type That Can Be Formatted;596
20.7;14-7. Implement a Custom Exception Class;599
20.8;14-8. Implement a Custom Event Argument;603
20.9;14-9. Implement the Singleton Pattern;605
20.10;14-10. Implement the Observer Pattern;607
21;Windows Integration;614
21.1;15-1. Access Runtime Environment Information;614
21.2;15-2. Retrieve the Value of an Environment Variable;618
21.3;15-3. Write an Event to the Windows Event Log;619
21.4;15-4. Read and Write to the Windows Registry;621
21.5;15-5. Search the Windows Registry;624
21.6;15-6. Create a Windows Service;627
21.7;15-7. Create a Windows Service Installer;632
21.8;15-8. Create a Shortcut on the Desktop or Start Menu;635
22;Index;639



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.