Visual basic6 black book

1.1K 134 0
Visual basic6 black book

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Visual Basic Black Book:Table of Contents Visual Basic Black Book (Publisher: The Coriolis Group) Author(s): Steven Holzner ISBN: 1576102831 Publication Date: 08/01/98 Introduction What's On the CD-ROM About the Author Chapter 1Visual Basic Overview Creating A Project In Visual Basic The Parts Of A Visual Basic Project Project Scope Projects On Disk Using The Visual Basic Application Wizard Visual Basic Programming Conventions Code Commenting Conventions Best Coding Practices In Visual Basic Getting Down To The Details Chapter 2The Visual Basic Development Environment In Depth Overview Of The Integrated Development Environment Immediate Solutions Selecting IDE Colors, Fonts, And Font Sizes Aligning, Sizing, And Spacing Multiple Controls Setting A Startup Form Or Procedure http://24.19.55.56:8080/temp/ (1 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Using Visual Basic Predefined Forms, Menus, And Projects Setting A Projects Version Information Setting An EXE Files Name And Icon Displaying The Debug, Edit, And Form Editor Toolbars Turning Bounds Checking On Or Off Checking For Pentium Errors Managing Add-Ins Adding ActiveX Controls And Insertable Objects To Projects Customizing Menus And Toolbars Setting Forms Initial Positions Enabling Or Disabling Quick Info, Auto List Members, Data Tips, And Syntax Checking Displaying Or Hiding IDE Windows Searching An Entire Project For Specific Text Or A Variables Definition Optimizing For Fast Code, Small Code, Or A Particular Processor Adding And Removing Forms, Modules, And Class Modules Using Bookmarks Using The Object Browser Chapter 3The Visual Basic Language In Depth How Does Visual Basic Code Look? Immediate Solutions Declaring Constants Declaring Variables Selecting Variable Types Converting Between Data Types http://24.19.55.56:8080/temp/ (2 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Setting Variable Scope Verifying Data Types Declaring Arrays And Dynamic Arrays Declaring Subroutines Declaring Functions Preserving Variables Values Between Calls To Their Procedures Handling Strings Converting Strings To Numbers And Back Again Handling Operators And Operator Precedence Using If&Else Statements Using Select Case Making Selections With Switch() And Choose() Looping Using Collections Sending Keystrokes To Other Programs Handling Higher Math Handling Dates And Times Handling Financial Data Ending A Program At Any Time Chapter 4Managing Forms In Visual Basic In Depth The Parts Of A Form The Parts Of An MDI Form Immediate Solutions Setting Title Bar Text http://24.19.55.56:8080/temp/ (3 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Adding/Removing Min/Max Buttons And Setting A Windows Border Adding Toolbars To Forms Adding Status Bars To Forms Referring To The Current Form Redrawing Form Contents Setting Control Tab Order Moving And Sizing Controls From Code Showing And Hiding Controls In A Form Measurements In Forms Working With Multiple Forms Loading, Showing, And Hiding Forms Setting The Startup Form Creating Forms In Code Using The Multiple Document Interface Arranging MDI Child Windows Opening New MDI Child Windows Arrays Of Forms Coordinating Data Between MDI Child Forms (Document Views) Creating Dialog Boxes All About Message Boxes And Input Boxes Passing Forms To Procedures Minimizing/Maximizing And Enabling/Disabling Forms From Code Chapter 5Visual Basic Menus In Depth Menu Design Considerations http://24.19.55.56:8080/temp/ (4 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Immediate Solutions Using The Visual Basic Application Wizard To Set Up Your Menus What Item Goes In What Menu? Adding A Menu To A Form Modifying And Deleting Menu Items Adding A Menu Separator Adding Access Characters Adding Shortcut Keys Creating Submenus Creating Immediate (Bang) Menus Using The Visual Basic Predefined Menus Adding A Checkmark To A Menu Item Disabling (Graying Out) Menu Items Handling MDI Form And MDI Child Menus Adding A List Of Open Windows To An MDI Forms Window Menu Making Menus And Menu Items Visible Or Invisible Creating And Displaying Pop-Up Menus Adding And Deleting Menu Items At Runtime Adding Bitmaps To Menus Using The Registry To Store A Most Recently Used (MRU) Files List Chapter 6Text Boxes And Rich Text Boxes In Depth Use Of Text Boxes And RTF Boxes In Windows Programs Immediate Solutions Creating Multiline, Word-Wrap Text Boxes http://24.19.55.56:8080/temp/ (5 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Aligning Text In Text Boxes Adding Scroll Bars To Text Boxes Making A Text Box Read-Only Accessing Text In A Text Box Selecting And Replacing Text In A Text Box Copying Or Getting Selected Text To Or From The Clipboard Creating A Password Control Controlling Input In A Text Box Adding An RTF Box To A Form Accessing Text In A Rich Text Box Selecting Text In Rich Text Boxes Using Bold, Italic, Underline, And Strikethru Indenting Text In Rich Text Boxes Setting Fonts And Font Sizes In Rich Text Boxes Using Bullets In Rich Text Boxes Aligning Text In A Rich Text Box Setting Text Color In RTF Boxes Moving The Insertion Point In RTF Boxes Adding Superscripts And Subscripts In Rich Text Boxes Setting The Mouse Pointer In Text Boxes And Rich Text Boxes Searching For (And Replacing) Text In RTF Boxes Saving RTF Files From Rich Text Boxes Reading RTF Files Into A Rich Text Box Printing From A Rich Text Box Chapter 7Command Buttons, Checkboxes, And Option Buttons http://24.19.55.56:8080/temp/ (6 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents In Depth How This Chapter Works Immediate Solutions Setting A Buttons Caption Setting A Buttons Background Color Setting Button Text Color Setting Button Fonts Reacting To Button Clicks Creating Button Control Arrays Resetting The Focus After A Button Click Giving Buttons Access Characters Setting Button Tab Order Disabling Buttons Showing And Hiding Buttons Adding Tool Tips To Buttons Resizing And Moving Buttons From Code Adding A Picture To A Button Adding A Down Picture To A Button Adding Buttons At Runtime Passing Buttons To Procedures Handling Button Releases Making A Command Button Into A Cancel Button Getting A Checkboxs State Setting A Checkboxs State Grouping Option Buttons Together Getting An Option Buttons State http://24.19.55.56:8080/temp/ (7 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Setting An Option Buttons State Using Graphical Checkboxes And Radio Buttons Using Checkboxes And Option Buttons Together Chapter 8List Boxes And Combo Boxes In Depth Immediate Solutions Adding Items To A List Box Referring To Items In A List Box By Index Responding To List Box Events Removing Items From A List Box Sorting A List Box Determining How Many Items Are In A List Box Determining If A List Box Item Is Selected Using Multiselect List Boxes Making List Boxes Scroll Horizontally Using Checkmarks In A List Box Clearing A List Box Creating Simple Combo Boxes, Drop-Down Combo Boxes, And Drop-Down List Combo Boxes Adding Items To A Combo Box Responding To Combo Box Selections Removing Items From A Combo Box Getting The Current Selection In A Combo Box Sorting A Combo Box Clearing A Combo Box Locking A Combo Box http://24.19.55.56:8080/temp/ (8 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Getting The Number Of Items In A Combo Box Setting The Topmost Item In A List Box Or Combo Box Adding Numeric Data To Items In A List Box Or Combo Box Determining Where An Item Was Added In A Sorted List Box Or Combo Box Using Images In Combo Boxes Chapter 9Scroll Bars And Sliders In Depth Adding Scroll Bars And Sliders To A Program Immediate Solutions Adding Horizontal Or Vertical Scroll Bars To A Form Setting Scroll Bars Minimum And Maximum Values Setting Up Scroll Bar Clicks (Large Changes) Setting Up Scroll Bar Arrow Clicks (Small Changes) Getting A Scroll Bars Current Value Handling Scroll Bar Events Handling Continuous Scroll Bar Events Showing And Hiding Scroll Bars Coordinating Scroll Bar Pairs Adding Scroll Bars To Text Boxes Creating And Using Flat Scroll Bars Customizing Flat Scroll Bar Arrows Creating Slider Controls Setting A Sliders Orientation Setting A Sliders Range Setting Up Slider Groove Clicks http://24.19.55.56:8080/temp/ (9 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Table of Contents Adding Ticks To A Slider Setting A Sliders Tick Style Getting A Sliders Current Value Handling Slider Events Handling Continuous Slider Events Handling Slider Selections Clearing A Selection In A Slider Creating An Updown Control Setting An Updown Controls Minimum And Maximum Handling Updown Events Chapter 10Picture Boxes And Image Controls In Depth Image Controls Picture Boxes Immediate Solutions Adding A Picture Box To A Form Setting Or Getting The Picture In A Picture Box Adjusting Picture Box Size To Contents Aligning A Picture Box In A Form Handling Picture Box Events (And Creating Image Maps) Picture Box Animation Grouping Other Controls In A Picture Box Using A Picture Box In An MDI Form Drawing Lines And Circles In A Picture Box Using Image Lists With Picture Boxes http://24.19.55.56:8080/temp/ (10 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book:Index Alignment property, 200201 DataField, DataSource properties, 835, 838839, 840841 Enabled property, 202 HideSelection property, 204 Locked property, 202 MaxLength property, 201 Multiline property, 200, 201 PasswordChar property, 205206 ScrollBars property, 201, 293294 SelLength property, 204 SelStart property, 204 SelText property, 204 Text property, 203 read-only text boxes, 202 replacing text, 204 restricting input characters, 206207 selecting text, 204 setting text, 203 word wrap, 200 Text data, sending, 425 Text property combo boxes, 265, 267, 270271 flex grid control, 393, 394 RTF boxes, 208209 status bar panels, 486 text boxes, 203 TextArray property, 400 TextHeight method, 589 http://24.19.55.56:8080/temp/book-index.html (124 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index TextRTF property, 208209 TextStream objects, 542, 575579 TextWidth method, 589 Thread-per-object model, 936 Thread pooling, 936 Threading models, 936, 963 Thumb of scroll bars, 283 Tic-tac-toe game (ActiveX document example), 684689 Tick marks, slider controls, 299300, 300 TickFrequency property, 299300 TickStyle property, 300 Time formats, 114115, 413415, 746747 Time function, 115 Time$ function, 413 TimeFormat property, 746, 770 Timer control, 406407 accuracy of, 413 adding to forms, 412 animation using image list control, 419421 current time, displaying, 415 elapsed time, displaying, 417 example programs, 415419 formatting date and time values, 413415 initializing, 412 properties Enabled property, 412 Interval property, 412 Timer event, 412, 413 http://24.19.55.56:8080/temp/book-index.html (125 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index using with progress bar, 492493 Timer event, 412, 413 TimeSerial function, 90, 115 TimeValue function, 90, 115 Title bar text, 121, 346347, 802803 Title bars, 118 Titles for Help pages, 10571058 To property, 770 Toggle buttons in toolbars, 477 Tool tips, 45, 238, 10581060 Toolbars, 465 adding buttons, 471, 482484 adding combo boxes, 479481 adding images to buttons, 475476 adding to forms, 469 aligning, 470 button groups, 478 button properties Index property, 471, 475 Key property, 125, 471 Style property, 474475, 477, 479 ToolTipText property, 481 ButtonClick event, 471472 Buttons collection, 482484 check buttons, 477 connecting buttons to menu items, 473 creating using picture boxes, 322 in forms, 119, 123125126 http://24.19.55.56:8080/temp/book-index.html (126 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index handling button clicks, 472 in IDE, 44, 61, 6769 methods RestoreToolbar method, 482 SaveToolbar method, 482 properties Align property, 470 AllowCustomize property, 482 ImageList property, 476 separators, 474475 tool tips, 481 user customization, 482 Toolbox, DHTML Page Designer, 710711, 712713, 716717 Toolbox, Visual Basic, 48, 664 Tools menu, IDE, 43 ToolTipText property, 238, 439, 481 Top property buttons, 239 forms, 133 frame control, 440 label control, 443 shape control, 454 ToPage property, 364 TopIndex property, 274275 Total disk space, determining, 813814 Trademark information, adding to projects, 59 Transactions, ADO, 854 Transferring files See FTP (File Transfer Protocol) http://24.19.55.56:8080/temp/book-index.html (127 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index Trappable errors Cancel button, Common Dialogs, 10281029 creating error objects, 10261027 determining source of error, 1022 determining which error occurred, 10201021 disabling error trapping, 10151016 disregarding errors, 1015 in DLLs, 1023 list of, 10031007 multimedia MCI control, 767768 nested error handling, 10241025 resuming execution, 10161020 retrieving error description, 10211022 user-defined errors, 10231024 using labels, 10121013 using line numbers, 1014 writing error handlers, 10091012 Tree views, 502 adding images, 515517 adding to forms, 510511 events Collapse event, 517 Expand event, 517 NodeClick event, 518 expanding and collapsing nodes, 517518 node properties Expanded property, 518 Image property, 515 http://24.19.55.56:8080/temp/book-index.html (128 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index Key property, 512 nodes, 511512 properties, Style property, 511 style, selecting, 511 subnodes, 513515 Trigonometric functions, 114 Trim function, 101 TwipsPerPixelX property, 608 TwipsPerPixelY property, 608 Type casting See Converting data between variable types Type keyword, 11, 86, 93 Type libraries, code components, 940, 941 Type of control, determining at runtime, 972973 TypeOf keyword, 972973 Types See Variable types U UBound function, 96 Ubound property, 973 UCase function, 90, 101 Underline property, 590 Underlining text in RTF boxes, 209211 Units of measurement, 17, 53, 133, 328, 337338, 606607 Unload statement, 137, 189, 242 Unlocking memory, 808809 UpClick event, 308309 Update method, 868869 Update method, OLE objects, 898 Updated event, 930931 http://24.19.55.56:8080/temp/book-index.html (129 of 138) [3/14/2001 2:14:22 AM] Visual Basic Black Book:Index UpdateInterval property, 750 UpdateRecord method, 845 Updown controls, 284, 307309 UpDown property, 410, 430 URL property, 1066 URLs, 700703, 716717 UseMnemonic property, 447 User controls See ActiveX controls User-defined coordinate systems, 133, 607 User-defined data types, 89 User-defined errors, 10231024 User registration, online, 10651068 User32.dll, 774 UserName property, 727 V Val function, 90, 102 Value, passing arguments by, 776 Value property checkboxes, 245246 DateTimePicker control, 430 MonthView control, 429 option buttons, 247248 progress bars, 492 scroll bars, 289 slider controls, 301, 302 Variable-length arrays, 968 Variable-length strings, 101 Variable scope, 11, 37 http://24.19.55.56:8080/temp/book-index.html (130 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index Variable scope prefixes, 28 Variable type prefixes, 2829 Variable types, 8889 C/C++ data type correspondences, 776778 converting between types, 90, 102 default type, 88 field types, DAO TableDef object, 860 Hungarian prefix notation, 776777 list of, 78 specifying using As keyword, 11 used in Windows API, 778779 variable prefixes, 2829 verifying type, 91, 93 Windows-defined data types, 777778 Variables commenting conventions, 3334 declaring, 11, 8687 implicit declaration, 87 Option Explicit statement, 38, 88 Option Private Module statement, 91 variable scope, 9091 variable types, 8889 default initialization, 87 examining values of (debugging), 10331036 form-level variables, 91 form-wide variables, 7, global variables, 10, 91 literal suffix symbols, 88 http://24.19.55.56:8080/temp/book-index.html (131 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index module-level variables, 91 names, misspelling, 38 preserving values, 99100 procedure-level variables, 91 variable scope, 11, 37, 9091 variable scope prefixes, 28 variable type, verifying, 91, 93 variable type prefixes, 2829 variable types, 78 viewing definition in IDE, 74 Variant arrays, 951953 Variant variable type, 38, 8889, 89 VBD files (ActiveX document specification files), 651, 686, 690691 VbOLEInPlaceActivate verb, 897 VbOLEOpen verb, 897 VBP files (project files), 15, 25 VBW files (project files), 16 Version control, 39 Version information, 59 Version.dll, 774 Vertical scroll bars, 286 See also Scroll bars Vertical Spacing item, Format menu, 5253 View menu, 43, 73, 165 View modes, list views, 504, 519, 524525 View property, 524, 525 Visible property buttons, 237238 combo boxes, 273 http://24.19.55.56:8080/temp/book-index.html (132 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index controls, 132 menu items, 184, 188 menus, 184 multimedia MCI control, 749 pop-up menus, 184 scroll bars, 292 Visual Basic best coding practices, 3638 commenting conventions, 3334 editions of, naming conventions, 2833 project types supported by, 23 Visual Basic API Viewer, 779 Visual Basic Application Wizard adding status bars to forms, 484 adding toolbars to forms, 123125, 469 designing menus, 157 integrating Web browsers into projects, 691692 online help system, 10631064 profiles, 23 projects, creating, 2228 Visual Basic color constants, 586587 Visual Basic Global object, 994 Visual Basic Integrated Development Environment See IDE (Integrated Development Environment) Visual Basic Menu Editor See Menu Editor Visual Basic project groups, 662664 Visual C++ code, 816818 Visual Component Manager, 5657, 58, 6566, 176178 http://24.19.55.56:8080/temp/book-index.html (133 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index Visual Data Manager, 830833 W Wait property, 771 Watch window, 1034 WAV files, playing, 755757 Web browser control, 696 See also Web browsers events, DownloadComplete event, 701 methods GoBack method, 704 GoForward method, 704 GoHome method, 701, 705 GoSearch method, 705 Navigate method, 700 Refresh method, 705 Stop method, 705 online help system, 10631064 properties, LocationName property, 701, 705 Web browsers See also Web browser control allowing navigation to URLs, 700703 creating, 696, 699700 integrating into Visual Basic programs, 691692 specifying home page, 701 standard buttons, 705 URLs, specifying, 700703 Web pages See also ActiveX documents DHTML pages, testing, 707, 717 directories, downloading, 731, 732 embedding ActiveX controls in, 657 http://24.19.55.56:8080/temp/book-index.html (134 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index including Visual Basic code in, 706 Weekday function, 90 Weight property, 590 While loop, 109 Whiteness pen setting, 605 Width property buttons, 239 forms, 133 frame control, 440 label control, 443 picture boxes, 338, 607 Screen object, 608 shape control, 454 Win32 Software Development Kit (Microsoft), 779 Win32api.txt, 778779 Window coordinates, translating to screen coordinates, 790 Window handles, 800802, 811 Window list, adding to menus, 182183 Window menu, 44, 165, 182183 WindowFromPoint Windows API function, 800802 Windowless controls, 990991 WindowList property, 183 Windows capturing mouse events outside of, 789793 device contexts, retrieving, 780 forcing to topmost position, 810812 hiding, 136 specifying Z-order position, 810812 http://24.19.55.56:8080/temp/book-index.html (135 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index title bar text, 121, 802803 window handles, retrieving, 800802 Windows, IDE, 73 Windows 95 taskbar, 995 Windows API core Windows DLLs, 774 sounds, playing, 804805 Visual Basic API Viewer add-in tool, 779 window handles, retrieving, 800802 Windows API functions See also names of specific functions calling, 775 correspondences between data types and Visual Basic variable types, 776778 declarations, adding to Visual Basic programs, 779 declaring, 775776 Windows applications See also headings beginning with OLE Designed for Microsoft Windows logo, 10411042 dragging data between applications, 983990 giving focus to, 112 sending keystrokes to, 110112 Windows character set, limiting fonts to, 360 Windows Common Controls coolbars, 466467, 493497 displaying images, 616 ImageList property, 508 progress bars, 466467, 491493 status bars, 126127, 465466, 484491 toolbars, 125, 322, 465, 469484 Windows Help, displaying from Common Dialog controls, 368370 See also Help files http://24.19.55.56:8080/temp/book-index.html (136 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index Windows installation directory, 814815 Windows Registry deleting settings, 999 Most Recently Used (MRU) files list, 192195 registering ActiveX controls, 664 retrieving settings, 192193, 997998, 999 storing settings, 193195, 997 WindowState property, 151 WinHelp Windows API function, 10611062 Winmm.dll, 774 With statement, 109 WithEvents keyword, 86, 94 Wizards See also Visual Basic Application Wizard ActiveX Control Interface Wizard, 669, 675, 680 ActiveX Document Migration Wizard, 683 Data Form Wizard, 840, 841843 Package and Deployment Wizard, 1039, 10431048 Property Page Wizard, 680681 Word wrap in text boxes, 200 WordWrap property, 445 Workspace object, DAO, 825, 857858 Write # statement, 550551 Write method, 577 WriteLine method, 577 WriteProperties event, 671672, 693694 Writing to binary files, 554 Writing to random access files, 552553 Writing to sequential files, 550551 http://24.19.55.56:8080/temp/book-index.html (137 of 138) [3/14/2001 2:14:23 AM] Visual Basic Black Book:Index X X1, X2 properties, 455, 457 XML (Extended Markup Language), 697, 698 Xor Pen pen setting, 604, 605 Y Y1, Y2 properties, 455, 457 Year function, 90 Z Z-order position, 810812, 976 Zooming OLE objects, 928 ZOrder method, 976 http://24.19.55.56:8080/temp/book-index.html (138 of 138) [3/14/2001 2:14:23 AM] ... 5Visual Basic Menus In Depth Menu Design Considerations http://24.19.55.56:8080/temp/ (4 of 35) [3/14/2001 1:24:08 AM] Visual Basic Black Book: Table of Contents Immediate Solutions Using The Visual. . .Visual Basic Black Book: Table of Contents Using Visual Basic Predefined Forms, Menus, And Projects Setting A Projects Version... [3/14/2001 1:24:09 AM] Visual Basic Black Book: Table of Contents Closing A TextStream Chapter 18Working With Graphics In Depth Graphics Methods Vs Graphics Controls About Visual Basic Coordinates

Ngày đăng: 26/03/2019, 11:12

Mục lục

    Visual Basic 6 Black Book

    Whats on the CD-Rom

    Chapter 1 - Visual Basic Overview

    Chapter 2 - The Visual Basic Development Environment

    Chapter 3 - The Visual Basic Language

    Chapter 4 - Managing Forms in Visual Basic

    Chapter 5 - Visual Basic Menus

    Visual Basic 6 Black Book:Visual Basic Menus

    Chapter 6 - Text Boxes and Rich Text Boxs

    Chapter 7 - Command Buttons, Checkboxes, and Option Buttons