Cover image for Ready-to-run Visual Basic code library : tips, tricks, and workarounds for better programming
Title:
Ready-to-run Visual Basic code library : tips, tricks, and workarounds for better programming
Author:
Stephens, Rod, 1961-
Personal Author:
Publication Information:
New York : John Wiley, 1999.
Physical Description:
xxii, 424 pages : illustrations ; 23 cm + 1 computer laser optical disc (4 3/4 in.)
Language:
English
Title Subject:
ISBN:
9780471333456
Format :
Book

Available:*

Library
Call Number
Material Type
Home Location
Status
Item Holds
Searching...
QA76.73.B3 S8339 1999 Adult Non-Fiction Central Closed Stacks
Searching...

On Order

Summary

Summary

An arsenal of more than 170 proven techniques and ready-to-run source code for better and more efficient programming Ready-to-Run Visual Basic(r) Code Library Thousands of VB programmers the world over have benefited from the stockpile of ready-to-run programming techniques available on Rod Stephens' VB Helper Web site. Now, by popular demand for more working programs, here are 173 never-before-published basic, intermediate, and advanced techniques that will help you successfully tackle real-world programming situations you'll encounter. Grouped by topic for easy reference, the ready-to-run programs contained in this book/CD package provide solutions for many aspects of VB programming, including:
* Manipulating numbers and working with variables
* Manipulating databases
* Handling text and formatting output
* Getting the most out of ListBox, ComboBox, ListView, TreeView, ProgressBar, TabStrip, Multimedia MCI, and other VB controls
* Creating menus
* Handling forms
* Animation
* Networking
The CD-ROM provides you with:
* Ready-to-run source code for all the examples in the book
Visit the author's comprehensive Visual Basic site at: www.vb-helper.com Wiley Computer Publishing Timely. Practical. Reliable. Visit our Web site at www.wiley.com/compbooks/


Author Notes

Rod Stephens is a software engineer specializing in algorithms, graphics, and user interface design. A well-known columnist, book author, and VB guru, Rod has been an instructor at MIT and a senior member of the technical staff at GTE Laboratories, where he built several award-winning computer systems. His other books from Wiley include Visual Basic Graphics Programming, Ready-to-Run Visual Basic Algorithms, and Custom Controls Library.


Table of Contents

Introductionp. xv
Chapter 1 Working with Variablesp. 1
1. Initialize Arraysp. 1
How It Worksp. 2
2. Copy Memory Quickly Using the APIp. 3
How It Worksp. 4
3. Copy Memory Quickly in Visual Basic 6p. 5
How It Worksp. 6
4. Empty Collections Quicklyp. 7
How It Worksp. 7
5. Use Arrays Not Collectionsp. 8
How It Worksp. 8
6. Create Objects Quicklyp. 9
How It Worksp. 10
7. Use Nested UDTsp. 10
How It Worksp. 11
8. Create Global Propertiesp. 13
How It Worksp. 14
9. Hide Data Inside Modulesp. 15
How It Worksp. 15
10. Use Classes and Modulesp. 16
How It Worksp. 17
11. Use Implementsp. 18
How It Worksp. 18
12. Use Concrete Object Typesp. 21
How It Worksp. 22
13. Track Object Creation and Destructionp. 23
How It Worksp. 24
14. Understand Parenthesized Argumentsp. 24
How It Worksp. 25
15. Beware of Foreign Syntaxp. 26
How It Worksp. 27
16. Understand Null Valuesp. 28
How It Worksp. 28
Nullp. 28
Emptyp. 29
vbNullStringp. 29
Nothingp. 29
Program Nullsp. 30
Chapter 2 Manipulating Numbersp. 33
17. Generate Random Valuesp. 33
How It Worksp. 34
18. Seed Rndp. 35
How It Worksp. 36
19. Cipher Textp. 36
How It Worksp. 37
20. Randomize a Listp. 40
How It Worksp. 40
21. Randomize a Two-Dimensional Arrayp. 41
How It Worksp. 42
22. Sort a Listp. 43
How It Worksp. 43
23. Remove Duplicates from a Listp. 45
How It Worksp. 46
24. Take Numeric Rootsp. 46
How It Worksp. 47
Chapter 3 Handling Textp. 49
25. Search a TextBoxp. 49
How It Worksp. 50
Initializationp. 50
Finding Textp. 51
Replacing Textp. 53
Replacing Allp. 54
26. Find Last Occurrencesp. 56
How It Worksp. 56
27. Tokenize Stringsp. 57
How It Worksp. 57
28. Parse Commandsp. 59
How It Worksp. 59
29. Replace Text Occurrencesp. 60
How It Worksp. 61
30. Make a TextBox Capitalize Inputp. 61
How It Worksp. 62
31. See If a String Is Blankp. 63
How It Worksp. 63
Chapter 4 Formatting Outputp. 65
32. Format Numbersp. 66
How It Worksp. 66
33. Change Casep. 67
How It Worksp. 68
34. Convert Valuesp. 69
How It Worksp. 69
35. Justify Output with a Monospaced Fontp. 70
How It Worksp. 70
36. Justify Output with a Proportional Fontp. 72
How It Worksp. 73
37. Track the Clipboardp. 74
How It Worksp. 74
38. Copy, Cut, and Paste Picturesp. 76
How It Worksp. 76
39. Display an Integer in Binaryp. 78
How It Worksp. 79
Chapter 5 Tackling Timersp. 81
40. Make a Blinking Labelp. 82
How It Worksp. 82
41. Make Text Blink in a PictureBoxp. 83
How It Worksp. 84
42. Make a Program Countdownp. 85
How It Worksp. 86
43. Display a Digital Clockp. 87
How It Worksp. 87
44. Trigger Alarmsp. 88
How It Worksp. 88
45. Make a Long Waiting Timerp. 90
How It Worksp. 91
46. Scroll Textp. 93
How It Worksp. 93
Chapter 6 Starting and Stoppingp. 97
47. Check Command-Line Parametersp. 97
How It Worksp. 98
Starting in the IDEp. 99
Starting in a DOS Windowp. 99
Starting from Another Programp. 100
Using Windows Explorerp. 100
Using Shortcutsp. 100
48. Check Environment Variablesp. 100
How It Worksp. 101
49. Start Another Programp. 102
How It Worksp. 103
50. Change Environment Variablesp. 104
How It Worksp. 104
51. See if the IDE Is Runningp. 105
How It Worksp. 106
52. Allow Only One Instancep. 106
How It Worksp. 107
53. Get the Windows Versionp. 107
How It Worksp. 108
54. Unload All Formsp. 109
How It Worksp. 110
55. Run a DOS Batch Filep. 110
How It Worksp. 111
56. Wait for Another Programp. 111
How It Worksp. 112
57. Invoke Default Actionsp. 113
How It Worksp. 114
Chapter 7 Network Programmingp. 115
58. Map a Network Sharep. 115
How It Worksp. 116
59. Display a Web Documentp. 117
How It Worksp. 118
60. Display HTML Codep. 119
How It Worksp. 119
61. Parse HTML Codep. 120
How It Worksp. 121
Chapter 8 Taming TextBoxesp. 125
62. Show New Textp. 125
How It Worksp. 126
63. Clear All TextBoxesp. 126
How It Worksp. 127
64. Automatically Select Textp. 127
How It Worksp. 128
65. Convert Carriage Returns to Tabsp. 128
How It Worksp. 129
66. Make a RichTextBox Editorp. 130
How It Worksp. 130
Protecting Datap. 130
MRU Listp. 133
Formatting Fontsp. 136
67. Set TextBox Tabsp. 138
How It Worksp. 139
68. Set TextBox Marginsp. 140
How It Worksp. 140
69. Double-Click to Strike Out Linesp. 141
How It Worksp. 142
70. Display the Clicked Wordp. 143
How It Worksp. 144
71. Find the Word under the Mousep. 145
How It Worksp. 145
72. Give Different Words Different Cursorsp. 147
How It Worksp. 148
73. Validate Fieldsp. 149
How It Worksp. 149
74. Make All Text Visiblep. 151
How It Worksp. 152
75. Hide a TextBox's Caretp. 153
How It Worksp. 153
76. Replace a TextBox's Context Menup. 155
How It Worksp. 156
77. Disable a TextBox's Context Menup. 156
How It Worksp. 157
78. Right Justify Single-Line Textp. 158
How It Worksp. 159
Chapter 9 Using ListBoxes and ComboBoxesp. 161
79. Find Selected Itemsp. 161
How It Worksp. 162
80. Find an ItemData Valuep. 163
How It Worksp. 163
81. Change Dropdown Heightp. 164
How It Worksp. 165
82. Change Dropdown Widthp. 166
How It Worksp. 167
83. Set Tabs in a ListBoxp. 168
How It Worksp. 169
84. Move Items between Listsp. 170
How It Worksp. 171
85. Save and Restore a ComboBoxp. 174
How It Worksp. 174
86. Match ListBox Prefixesp. 176
How It Worksp. 177
87. Detect ComboBox Dropdownp. 177
How It Worksp. 178
Chapter 10 Using ListView and TreeViewp. 181
88. Use a ListView Controlp. 181
How It Worksp. 182
89. Use a TreeView Controlp. 185
How It Worksp. 186
90. Let the User Drag TreeView Nodesp. 191
How It Worksp. 191
91. Save and Restore a TreeViewp. 194
How It Worksp. 194
Serializationp. 195
Unserializationp. 197
92. Combine TreeViews and ListViewsp. 204
How It Worksp. 204
Chapter 11 Using Other Controlsp. 207
93. Play an AVI Video Filep. 207
How It Worksp. 208
94. Play a Wave Audio Filep. 209
How It Worksp. 209
95. Make a Button Ignore Return Keysp. 210
How It Worksp. 211
96. Use a ProgressBarp. 212
How It Worksp. 213
97. Use a StatusBarp. 215
How It Worksp. 215
98. Let the User Select a Fontp. 217
How It Worksp. 217
99. Let the User Select a Filep. 219
How It Worksp. 219
100. Use Tabsp. 222
How It Worksp. 222
101. Use Buttons with Picturesp. 224
How It Worksp. 224
102. Make a Highlighting Controlp. 225
How It Worksp. 225
Chapter 12 Managing Controlsp. 229
103. Learn Control Array Boundsp. 229
How It Worksp. 230
104. Create Controls at Run Time Using Loadp. 231
How It Worksp. 232
105. Create Controls at Run Time in Visual Basic 6p. 233
How It Worksp. 233
106. Enable the Controls in a Containerp. 235
How It Worksp. 235
107. Use Acceleratorsp. 236
How It Worksp. 236
108. Save and Restore Control Valuesp. 237
How It Worksp. 238
109. Manage Two-Dimensional Control Arraysp. 240
How It Worksp. 241
110. Build a Splitterp. 243
How It Worksp. 243
111. Build a Scrolled Windowp. 245
How It Worksp. 246
Chapter 13 Generating Graphicsp. 249
112. Separate Colorsp. 250
How It Worksp. 251
113. Draw a Color Gradientp. 252
How It Worksp. 252
114. Use Compressed Graphicsp. 254
How It Worksp. 254
115. Resize Using PaintPicturep. 255
How It Worksp. 255
116. Tile a Form Using PaintPicturep. 257
How It Worksp. 257
117. View Imagesp. 259
How It Worksp. 259
118. Let the User Select Areasp. 262
How It Worksp. 262
119. Simulate Alt-PrntScrnp. 266
How It Worksp. 267
120. Use BitBlt and StretchBltp. 268
How It Worksp. 269
121. Center an Imagep. 272
How It Worksp. 273
122. Use FloodFillp. 274
How It Worksp. 274
123. Use Polygonp. 276
How It Worksp. 276
124. Stretch a Picturep. 278
How It Worksp. 278
Chapter 14 Implementing Animationp. 281
125. Bounce a Ballp. 281
How It Worksp. 282
126. Bounce a Ball Fasterp. 284
How It Worksp. 285
127. Bounce a Ball on a Backgroundp. 285
How It Worksp. 286
128. Drag a Picturep. 288
How It Worksp. 289
Chapter 15 Using Fontsp. 293
129. List Available Fontsp. 293
How It Worksp. 294
130. Use Superscripts and Subscriptsp. 298
How It Worksp. 299
131. Create New Fontsp. 300
How It Worksp. 301
132. Create Rotated Fontsp. 305
How It Worksp. 305
133. Draw Curved Textp. 309
How It Worksp. 309
Chapter 16 Making Menusp. 313
134. Use Popup Menusp. 313
How It Worksp. 314
135. Make Menu Items at Run Timep. 315
How It Worksp. 316
136. Disable the Close Commandp. 317
How It Worksp. 318
137. List a Form's Menusp. 320
How It Worksp. 320
138. Hide a Form's Menusp. 322
How It Worksp. 322
139. Hide a Form's Menus Using the APIp. 323
How It Worksp. 324
140. Add to the System Menup. 325
How It Worksp. 325
Chapter 17 Managing Formsp. 329
141. Size a Form in Inchesp. 329
How It Worksp. 330
142. Keep a Form on Top of Anotherp. 330
How It Worksp. 331
143. Display a Form by Namep. 331
How It Worksp. 332
144. Display a Single Form by Namep. 333
How It Worksp. 334
145. Manage Hourglass Cursorsp. 335
How It Worksp. 336
146. Make an Elliptical Formp. 337
How It Worksp. 337
147. Make a Polygonal Formp. 339
How It Worksp. 339
148. Make a Form with a Hole in Itp. 341
How It Worksp. 342
149. Center a Formp. 344
How It Worksp. 344
150. Read Windows Messagesp. 344
How It Worksp. 345
151. Fix a Form's Widthp. 348
How It Worksp. 348
152. Display an Icon in the System Trayp. 350
How It Worksp. 351
153. Move a Form without a Title Barp. 356
How It Worksp. 356
Chapter 18 Using Files and Directoriesp. 359
154. See If a File Existsp. 359
How It Worksp. 360
155. Read a File's Contentsp. 362
How It Worksp. 363
156. Read and Write Arraysp. 364
How It Worksp. 364
157. Count the Lines in a Filep. 367
How It Worksp. 367
158. Filter a Filep. 368
How It Worksp. 369
159. List a Directory's Subdirectoriesp. 371
How It Worksp. 372
160. Search for Filesp. 374
How It Worksp. 375
161. Search for Files Using the APIp. 377
How It Worksp. 377
162. Find a Directory's Sizep. 380
How It Worksp. 381
163. Copy a Directory Hierarchyp. 383
How It Worksp. 383
164. Move a File into the Wastebasketp. 385
How It Worksp. 386
165. Display Disk Volume Informationp. 387
How It Worksp. 387
Chapter 19 Using the Registryp. 391
166. Track a Program's Usagep. 391
How It Worksp. 392
167. Use a One-Time Passwordp. 394
How It Worksp. 394
168. Perform One-Time Initializationp. 396
How It Worksp. 396
169. Provide a Tip-of-the-Dayp. 397
How It Worksp. 398
170. Save and Restore Settingsp. 401
How It Worksp. 401
171. Read Unusual Registry Keysp. 403
How It Worksp. 404
172. Read Internationalization Keysp. 406
How It Worksp. 407
173. List Subkeys within a Keyp. 408
How It Worksp. 409
Indexp. 413