Newsgroups: comp.lang.basic.visual,comp.answers,news.answers Path: news.alpha.net!news.mathworks.com!uhog.mit.edu!news.mtholyoke.edu!news.byu.edu!news.provo.novell.com!park.uvsc.edu!knosack From: knosack@park.uvsc.edu (Kris Nosack) Subject: FAQ: comp.lang.basic.visual VB/Win Frequently Asked Questions X-Content-Currency: This FAQ changes regularly. When a saved or printed copy is over 6 months old, please obtain a new one. Expires: Mon, 7 Nov 1994 04:30:33 GMT Reply-To: Jan.Haugland@uib.no (Jan Steinar Haugland) Organization: Visual Basic FAQ Maintainers Date: Fri, 21 Oct 1994 05:30:44 GMT Approved: news-answers-request@MIT.Edu X-Posting-Frequency: Posted on the 5th and 20th of each month. Message-ID: Followup-To: comp.lang.basic.visual Summary: Frequently asked questions concerning Visual Basic for Windows. Keywords: FAQ VISUAL BASIC WINDOWS Sender: knosack@park.uvsc.edu (Kris Nosack) Supersedes: Lines: 2342 Xref: news.alpha.net comp.lang.basic.visual:17312 comp.answers:2435 news.answers:7923 Posted-By: auto-faq 3.1.1.2 Archive-name: visual-basic-faq/windows Last-modified: 12.09.94 VISUAL BASIC FOR WINDOWS (VB/Win) Frequently asked Questions & Answers Section IX - B NOTE: From this issue of the FAQ I introduce symbols in topic header and TOC: [++] means topic is updated in this issue [**] means topic is new in this issue Hope this makes it easier for Our Regular Readers ;-) TABLE OF CONTENTS: ****************** A. PREFACE B. GENERAL VISUAL BASIC QUESTIONS 1. Does VB/Win make standalone .EXE files? 2. What is the current version of Visual Basic for Windows? 3. Where can I get updated VB and other Microsoft files? 4. Help! I am lost on ftp.microsoft.com. [++] 5. Where can I get good up-to-date information about VB? [++] 6. Are there any examples of commercial applications built using Visual Basic? C. COMMON VISUAL BASIC PROGRAMMING QUESTIONS 1. What's the difference between MODAL and MODELESS forms? 2. When/Why should I use Option Explicit? 3. Why does everybody say I should save in TEXT not BINARY? 4. Is the Variant type slower than using other variable types? 5. How do I make a text box not beep but do something else when I hit the Enter key? 6. How do I implement an incremental search in list/dir/combo/file boxes? 7. How do I get the Tab key to be treated like a normal character? 8. How do I make an animated icon for my program? 9. What is passing by reference? 10. I get a "file not found" error on the IIF function when I distribute by program. Uh? 11. Is there any way to pass a variable to a form apart from using global variables? 12. How should dates be implemented so they work with other language and country formats? 13. Can a VB application be an OLE server? 14. How do I dial a phone number without using the MSCOMM VBX? [++] 15. I have [several] megabytes of memory. Why do I get an "out of memory" error? 16. How do I mimic a toggle button? 17. How do I get my application on top? 18. Is there a way to break long lines in VB code? 19. How do I remove/change the picture property of a control at design time? 20. Is a [foo] VBX/DLL available as shareware/freeware? 21. How do I make my applications screen-resolution independent? 22. How do I do Peek and Poke? 23. Why doesn't "my string" & Chr$(13) do what I want? 24. How do I prevent multiple instances of my program? [++] 25. How do I implement an accelerator key for a text box? [**] D. ADVANCED VISUAL BASIC PROGRAMMING ISSUES 1. How do I tell when an application executed using the SHELL command is finished? 2. How do I access C style strings? 3. How can I change the printer Windows uses in code without using the print common dialog? 4. Any tips for speeding up VB? 5. How do I speed up control property access? 6. How much gain in performance will I get if I write my number crunching routines in C instead of Visual Basic? 7. How do you make a TEXTBOX read only? Or, how do I prevent the user from changing the text in a TEXTBOX? 8. How can I create a VBX? 9. How do you change the system menu (on the Control-Menu Box)? 10. How do I play MID, WAV or other multimedia files? 11. How can I call a 'hidden' DOS program from VB? 12. How do I do drag & drop between applications? 13. How do I use GetPrivateProfileString to read from INI files? 14. How do I implement Undo? 15. How do I create a window with a small title bar as in a floating toolbar? 16. What is Pseudocode? 17. Does VB support pointers to functions? 18. How do I program the Novell NetWare API from VB? 19. Some Visual Basic 4 rumours E. CALLING THE WINDOWS API AND DLLs IN GENERAL 1. What is the Windows API? 2. How do I call a DLL? 3. What about DLL calls that require callbacks? 4. Tips for calling DLLs (such as the Windows API) F. VISUAL BASIC AND DATABASES 1. Why can't I use an index with my VB accessed database? 2. Why does my compiled VB database app generate an error when it ran just fine in the design environment? 3. Is the Access Engine and Visual Basic Pro good enough for database work? 4. How do you avoid the "Invalid use of null" error when reading null values from a database? 5. What is "NULL"? 6. How can I access a record by record number? 7. How about Access 2.0 compatibility? 8. Tips for VB database programming: 9. How come I get a "No Current Record" error when I use a a Data Control on an empty table? 10. How can I speed up my VB database application? 11. How do I get a bitmap picture in a field in an Access database? G. DISTRIBUTING VISUAL BASIC APPLICATIONS 1. What are some tips for using Setup Wizard? 2. Are there restrictions on what I can distribute with my VB program? 3. What alternatives to setup wizard do I have? 4. Do I need to worry about users who have Progman replacements such as Norton Desktop and PC Tools? 5. Can I distribute my app without vbrunXXX.dll? 6. Why won't my setup program install commdlg.dll et. al.? 7. Where do I install VBXs and DLLs? H. MISCELLANEOUS TIPS AND INFORMATION 1. Multiple identifiers after the DIM statement can be confusing 2. "Clean up" your project before final EXE compilation. 3. Multiple END statements can be dangerous; or, The program that refused to terminate. 4. What are the latest versions of the various files used by VB? I. VISUAL BASIC FOR APPLICATIONS (VBA) 1. Any tips for VB/Win 3 programmers moving to VBA? 2. Does VBA support VBXs? 3. How do I access properties on my dialog boxes in VBA? 4. How do I use database routines from Excel VBA? A. PREFACE This document is a compilation of frequently asked questions and their answers about Visual Basic for Windows and Visual Basic for Applications which have been gathered from posts to the comp.lang.basic.visual newsgroup. Although efforts have been made to find obvious errors, there is no guarantee that the information in this document is error-free. Neither the FAQ maintainer nor anyone else associated with this document assume ANY liability for the content or use of this document. If you find any errors, please report them to the address given below. This FAQ document is protected by international copyright regulations. Permission is granted to distribute it freely, both in electronic and written format, provided no charge is made. Also, do not make changes to this document without the consent of the maintainer. Usenet netiquette applies. Most FAQs (including this one) are available at the anonymous ftp archive site "rtfm.mit.edu". All parts of the VB FAQ may be found in the directory "pub/usenet/comp.lang.basic.visual". You can also have the VB FAQs e-mailed to you by sending a message to "mail-server@rtfm.mit.edu" with ONLY the text send usenet/news.answers/visual-basic-faq/* in the BODY of the message. In this document, whenever a long line of code must be split into two or more lines of text in the code examples, a | symbol will precede each line which should be appended to the line above it. As the FAQ maintainer, I don't have time to explore all of the aspects of Visual Basic. I rely on your submissions to improve the quality and inclusiveness of this document. If you have found a VB hint, tip, trick, work-around, etc., please write it up and send it to me! Jan Steinar Haugland (Jan.Haugland@uib.no), VB/Win FAQ maintainer Please note that my first language is not English. You can safely ignore all typos, but if you find an error that is so embarrassing you can't help pulling your hair and screaming loud, just send me a note and I'll correct it quietly. OK? I would like to thank all contributers, and also all those who have given constructive feedback. This FAQ is now widely distributed in the net community. Special thanks to the following people who have made many and invaluable contributions to the VB/Win FAQ: Kris Nosack (the previous maintainer), Peter Millard, Nic Gibson, Mr. "D" (the anonymous contributor), George Tatge (gat@csn.org), Andy Dingley (dingbat@codesmth.demon.co.uk), and those I may have forgotten (sorry). Your help is GREATLY appreciated! B. GENERAL VISUAL BASIC QUESTIONS 1. Does VB/Win make standalone .EXE files? VB/Win produces .exe files, but they are not standalone. All VB/Win programs must be distributed with the VBRUNx00.DLL file (where x is the major version number). This DLL must accompany all VB/Win programs, but only one such file should reside on every system where VB programs are used. 2. What is the current version of Visual Basic for Windows? VB/Win is currently at version 3.0 3. Where can I get updated VB and other Microsoft files? Microsoft Software Library (MSL) is accessible from the following services: - Compu$erve GO MSL Search for - Microsoft Download Service (MSDL) Dial (206) 936-6735 to connect to MSDL - Internet (anonymous FTP) ftp ftp.microsoft.com Change to the \softlib\mslfiles directory (There are a LOT of files in this directory! It is not advisable to list all the files unless you have good time. See map below.) 4. Help! I am lost on ftp.microsoft.com. [++] You no longer have to be! The site have been reorganised, and you'll find the file DIRMAP.TXT in root (or whatever it's called on a 3.5 NT server). Here's the file as I found it (stolen ruthlessly from the server for your convenience): *-----------------------------------------------------------------------* This file is to help you find your way around ftp.microsoft.com. This file only covers the directory structure two levels deep. If you see a 'kb' directory in a second level directory, it contains all of the information regarding that second level directory. For example, the /developr/win32dk directory has a kb directory in it. This kb directory contains all of the articles for any 32 bit development kit. ROOT DIRECTORY SUB DIRECTORY CONTENTS -------------------------------------------------------------------- ADVSYS Advanced Systems, Networks, Mail LANMAN LanMan & other networks MAIL Mail and Schedule+ MSCLIENT Microsoft Networking Client SQL_ODBC SQL and ODBC WINNT Windows NT WINSOCK Windows Sockets information DESKAPPS Desktop Applications ACCESS Access DOSWORD Word for MS-DOS EXCEL Excel GAMES Entertainment Packs, Flight Sim, etc. HOMEAPPS Home applications (Fine Artist, Creative Writer) MISCAPPS Other applications MMAPPS Multimedia Titles OFFICE Microsoft Office POWERPT PowerPoint PROJECT Project PUBLISHER Publisher WORD Word for Windows & Macintosh WRKS_MNY Works and Money DEVELOPR Developer Tools and Information BASIC Quick Basic & other Basics DEVCAST DevCast information DEVUTIL MS Test, Delta, EXEMOD, EXEPACK, & LIB Utility DRG Developer Relations Group FORTRAN Fortran and Fortran PowerStation FOX FoxPro and FoxBase MAPI Messaging API information MASM Macro Assembler MSDN Microsoft Developer Network MSJ Microsoft Systems Journal OLE OLE TAPI Telephony API information VB Visual Basic VISUAL_C Visual C++, MFC, & other C products WIN_DK Windows SDK, DKs & At Work WIN32DK 32 bit Development Kits MSEDCERT Microsoft Education and Certification EDUCATIO Microsoft Education information CERTIFIC Microsoft Certified Professional info MSFT Microsoft shareholder information ANNREPT Microsoft Annual Report BACKGRND Background information on Microsoft PRESSREL Microsoft Press Releases SEC Recent filings with the Securities and Exchange Commission SOFTLIB Instructions & index for software library MSLFILES Software library files (> 1500 files) PEROPSYS Personal Operating Systems and Hardware HARDWARE Mouse & other Hardware MSDOS MS-DOS WINDOWS Windows (all versions) WIN_NEWS Information on Windows "Chicago" TECHNET Information on TechNet SERVDIR Microsoft Services Directory *---------------------------------------------------------------------* NOTE: Directory and file names at ftp.microsoft.com are NOT case sensitive. Thanks to Richard Mason (richard@whitney.demon.co.uk) for the map he made for us before this long overdue reorganisation, and thanks for bringing this to my attention. 5. Where can I get good up-to-date information about VB? [++] If you do any VB programming at all, you really should get the latest copy of the Microsoft Knowledge Base from one of the sources listed above! The filename is VBKB.EXE or VBKB_FT.EXE for the version with full text searching. The Knowledge Base is a Windows help formatted document that is updated almost monthly. (Beware: The files are huge!) The EXE files on ftp.microsoft.com (and other places) are simple self-extracting files. They don't do any automatic updating of your system, just dump the file(s) inside them in the current directory on your disk, uncompressed and ready for use. Just replace the old files on your system with the new files (same name, usually). This FAQ (ahem) is a pretty good source as a digest of many of the VB issues that are discussed in the comp.lang.basic.visual newsgroup, but as such the information contained in this FAQ may not have been thoroughly tested or verified. For easier access to and use of this FAQ document, get the Windows Help file format FAQ doc by anonymous ftp to quasar.sba.dal.ca and look under /www/hlp. The .HLP version is made by Tim Roberts (TJR@SBACOOP.SBA.DAL.CA). This is HIGHLY RECOMMENDED. Dave McCarter puts out a nice Windows help formatted document called "Visual Basic Tips and Tricks". A good resource with information that isn't found in the Knowledge Base. It can be found by anonymous ftp to ftp.cica.indiana.edu /pub/pc/win3/programr/vbasic/ as VBTIPS??.ZIP, where '??' is the version number (yes, get the one with the highest number). There is presently an effort to put together a VB code library so that VB users can share their best - and trickiest - programming work. The code library project is being spear headed by Hein Ragas who has managed to get a directory on CICA for code snippets to be deposited. Stayed tuned to comp.lang.basic.visual for more information. There's a VISBAS-L mailing list for Visual Basic. You can subscribe to this mailing list by sending an email to LISTSERV@tamvm1.tamu.edu Place the following text in the *body* of the message (no, not the subject line): SUB VISBAS-L Real Name Where Real Name is just that, *your full real name* not your email address. Note that the traffic on this list may overflow your mailbox if you have a limited mail buffer. Expect around 40-50 messages every weekday, a bit less during weekends. Also, to unsubscribe, do as above but with "UNSUB" in the body of the message to the LISTSERV address, *not* to the VISBAS-L list address itself (Believe it or not, we usually receive 2-3 sub/unsub mails every day on the list, and we're really fed up!) Also, this mail server was split and a new list called VBDATA-L was made for Vb database (Jet) related topics. Same procedure for registering (SUB VBDATA-L Real Name). Sorry, I know no mailservers or other Internet resources dedicated to VBA specifically. Send me any information you may have, and I'll bring it on. There are several Usenet newsgroups dedicated to MS Windows programming and use. There's recently been a major group creation process. Those groups that may be of special interest to VB programmers are marked with *: comp.os.ms-windows.misc comp.os.ms-windows.programmer.misc comp.binaries.ms-windows comp.os.ms-windows.advocacy comp.os.ms-windows.announce comp.os.ms-windows.apps comp.os.ms-windows.nt.misc comp.os.ms-windows.nt.setup comp.os.ms-windows.programmer.tools * comp.os.ms-windows.programmer.win32 comp.os.ms-windows.setup * comp.os.ms-windows.programmer.winhelp * comp.os.ms-windows.programmer.networks comp.os.ms-windows.programmer.graphics comp.os.ms-windows.programmer.controls * The latest groups have been added to split the enormous traffic on the *.misc groups down in managable chunks. However, the second group (.programmer.misc) contains lots of interesting info (mostly C related), if you have the time to read it all! Also note comp.lang.pascal which is a very good newsgroup for Pascal, including Borland Pascal and Turbo Pascal for Windows. Please don't use this guide to find out where you should crosspost VB questions. Check the charter for each group before posting to it. If you are sure that your crosspost is legitimate, please note the crossposting in the text. NOTE: PLEASE don't post VB stuff to comp.lang.visual. This group has *nothing* to do with Visual Basic, and the academics discussing "real" visual programming there are very, very annoyed at what they call "quasi-visual" stuff and postings about those languages to their group. If you have a Compu$erve account, you will find a forum for Visual Basic there, including some support from Microsoft: MS BASIC Forum (GO MSBASIC) Message Sections Available: Libraries Available: 1 Forum News/Info 1 MS Info and Index 2 Setup Wizard/Kit 2 Setup Wizard/Kit 3 Data Access Objects 3 Data Access Objects 4 The Data Control 4 The Data Control 5 Programming Issues 5 Programming Issues 6 ODBC Connectivity 6 ODBC Connectivity 7 SQL Queries 7 SQL Queries 8 ProEdition Controls 8 ProEdition Controls 9 Calling API's/DLL's 9 Calling API's/DLL's 10 Using OLE/DDE 10 VBWIN-ODBC/Database 11 MSCOMM control 11 MSCOMM control 12 MCI/MAPI controls 12 MCI/MAPI controls 13 DOS Visual Basic 13 DOS Visual Basic 14 DOS and Mac Basic 14 DOS and Mac Basic 15 Suggestions/Mktg. 15 Suggestions/Mktg. 16 CDK 16 CDK 17 3rd Party Products 17 3rd Party Products There are magazines dedicated to VB. The best known is Fawcett Technical Publications' _Visual Basic Programmer's Journal_ (VSPJ). Phone 800-848-5523 (for US credit card orders) or 303-541-0610 (int'l and US other orders), Email 74003.224@compuserve.com to Shirley Modric for subscription info. Address is 280 Second Street, Suite 200, Los Altos, CA 94022-3603 USA. From Randy Coates (rcoates@telerama.lm.com): I currently subscribe to "Inside Visual BASIC for Windows" from the Cobb Group. Although it is a helpful monthly paper (about 14 pages per publication), I find it to be overpriced when compared to VB Programmers Journal. Here is the information anyway: Domestic $59/yr ($7.00 each); Outside US $79/yr ($8.50 each) Phone: Toll Free: 800-223-8720), Local: 502-491-1900, Customer Relations Fax: 502-491-8050, Editorial Department Fax: 502-491- 4200. Address: _Inside Visual BASIC for Windows_, 9420 Bunsen Parkway, Suite 300, Louisville, KY 40220. (Note: for completeness other VB magazines should be listed, and I would like to receive info on those!) 6. Are there any examples of commercial applications built using Visual Basic? Profit by Microsoft was written mostly in Visual Basic. In fact, Profit was one of three programs selected as PC Magazine's Editor's Choice among Windows small business accounting packages. Microsoft uses VB extensively for smaller utilities. 3 of the small apps in the Windows and Windows for Workgroups Resource Toolkits are written in VB. Also, if you have the Microsoft Bookshelf CD- ROM, you will notice that the MVOPTION.EXE program, which is an "options" program for MS Viewer, is created in VB. Note: The existence of VBX files in a package doesn't ecessarily mean that it was written in VB. The most popular C++ compilers also support VBXes. C. COMMON VISUAL BASIC PROGRAMMING QUESTIONS 1. What's the difference between MODAL and MODELESS forms? MODAL forms are forms which require user input before any other actions can be taken place. In other words, a modal form has exclusive focus until it is dismissed. When showing a modal form, the program pauses at the SHOW command until the modal form is either hidden or unloaded. The internal MsgBox and InputBox forms are examples of modal forms. To show a form modally, use the syntax: MyForm.SHOW 1 MODELESS forms are those which are shown but do not require immediate user input. MDI child forms are always modeless. To show a form modeless, use the syntax: MyForm.SHOW 2. When/Why should I use Option Explicit? Option Explicit forces you to declare all variables before using them. Opinions vary greatly on this subject. The main reason to use the OPTION EXPLICIT statement at the top of all modules is to minimize the amount of bugs introduced into your code by misspelling a variable name. Most variants of BASIC (including VB) have the capability to create variables 'on the fly' (without any declarations). This capability can be a double edged sword. At the minimum, some suggest using the DEFINT A-Z statement in leu of OPTION EXPLICIT. This statement will cause any variables which are created on the fly to be created as integers as opposed to variant (VB 3.0) or single precision (VB 1.0 and 2.0). (Integers take up less memory). The OPTION EXPLICIT statement causes VB to 'disable' its ability to create variables on the fly. Thus, all variables must be declared using a DIM or REDIM statement. All variables not declared will cause an error when the OPTION EXPLICIT statement is used. This will eliminate bugs caused by a misspelled variable. The option works module-wide, so you can have some modules with and some without this option in your project. 3. Why does everybody say I should save in TEXT not BINARY? Actually, saving in binary mode is a bit faster, so why do we recommend you to save in text? If you save the source and the project as text, it becomes ASCII (or really, ANSI) code that you can edit with any text editor or (if you are careful when you save) word processor. If you save in binary, only the VB development environment, current or later versions, will understand the code. The Setup Wizard can not scan binary projects. Also, source documenters and other programming tools usually require text mode. If you use text, you can use a simple text editor (ie. notepad) to cut and paste code from other source/form modules into your current project. Some 'tricks' (like making an array of 1 control into a single non-array control again) is easily done with an editor but not that easy in the environment. If you want to print your project to paper the file|print option in the VB environment is often not good enough; you may want to import the text files into your word processor. And, finally, if something goes wrong (only one byte is changed!) you may be out of luck in binary mode. In text mode you will more easily be able to fix it. 4. Is the Variant type slower than using other variable types? Generally, yes, if we are talking numeric variable types. The Variant type also increases memory overhead. To test the speed difference, try the following piece of code in something like a button_click event and keep the debug window on the screen: Dim Va As Variant Dim In As Integer T1! = Timer For i% = 1 To 32766 Va = i% Next i% T2! = Timer Debug.Print "With variant: "; Format$((T2! - T1!), "0.0000") T1! = Timer For i% = 1 To 32766 In = i% Next i% T2! = Timer Debug.Print "With integer: "; Format$((T2! - T1!),"0.0000") This test shows (on our test system) that integers are ~60% faster! However, for strings there where no real difference, or in some instances, variants were faster than strings for routines with heavy conversion usage. For the best result in your application, test your routines directly. 5. How do I make a text box not beep but do something else when I hit the Enter key? Put "something else" in your _KeyPress event, depending on what you really want. This code example makes *nothing* happen, for an extended period of time: Sub Text1_KeyPress (KeyAscii As Integer) If KeyAscii = 13 Then '13 is Key_Return KeyAscii = 0 End If End Sub This might not be a very nice thing to do, since your users usually have some intention when they press Enter. Often they will want to jump to the next control, like the Tab key does. To have the Enter key emulate the Tab key action, you will need to add the line 'SendKeys "{tab}"' above 'KeyAscii=0' in the example above (Yes, I thought KeyAscii=9 works but it doesn't! Tab is obviously handled by Windows on a lower level). By the way, you'll also find this in the Microsoft VB Knowledge Base (see KB Q78305 and Q85562). Note: If MultiLine=True you will *not* want to disable the normal behaviour of the Enter key. 6. How do I implement an incremental search in list/dir/combo/file boxes? This is your lucky day. Dan Champagne (Dan_Champagne@dell.com) made some VB code (no DLLs are necessary!) which easily provides this feature for your applications: ' Code by Dan Champagne ' 4/18/94 ' This code can be used to do an incremental search in either a ' list box, dir, combo, or a file box. The following code is set ' for a file box called FILE1. To make it work with a list box, or ' a file box with a different name, change all occurences of FILE1 ' with whatever you or VB has named your list, combo, dir, or file box. ' There are two places where you will need to change these. They are ' on the last couple of lines in the KeyPress code. ' Also, thanks to John Tarr for helping debug the code. 'In a .BAS file, add the following: 'searchme$ is a global vaiable that will keep track of what the 'user has typed so far. Global searchme$ 'The following needs to be on one line. Declare Function SendMessageBystring& Lib "User" ALIAS |"Send Message" (ByVal hWnd%, ByVal wMsg%, ByVal |wParam%, ByVal lParam$) Global Const WM_USER = &H400 Global Const LB_SELECTSTRING = (WM_USER + 13) Global Const LB_FINDSTRING = (WM_USER + 16) 'In File1 under keydown, add the following: 'This checks if the user has pressed the up or down arrow. 'If they have, reset searchme$ to "". If KeyCode = 40 Or KeyCode = 38 Then searchme$ = "" End If 'In File1 under lostfocus, pathchange, patternchange, and click add: 'If the user has done any of the above, reset the searchme$ 'string. searchme$ = "" 'In File1 under keypress add: Dim result& Select Case KeyAscii Case 8 'Backspace If searchme$ <> "" Then searchme$ = Left$(searchme$, Len(searchme$) - 1) Else File1.ListIndex = 0 End If KeyAscii = 0 Exit Sub Case 27 'Escape searchme$ = "" KeyAscii = 0 Exit Sub Case 13 'Enter searchme$ = "" KeyAscii = 0 Exit Sub Case Asc("a") To Asc("z"), Asc("A") To Asc("Z"), Asc("'"), |Asc("."), Asc(" "), Asc("0") To Asc("9") searchme$ = searchme$ & Chr$(KeyAscii) KeyAscii = 0 End Select result& = SendMessageBystring(FILE.hWnd, LB_FINDSTRING, |0, searchme$) If result& = -1 Then searchme$ = Left$(searchme$, Len(searchme$) - 1) Else result& = SendMessageBystring(FILE1.hWnd, LB_SELECTSTRING, |-1, searchme$) End If