Checking A Database File

This prompted me to do a little digging and I found out that it couldn't access the file to check because it was open in MS Access 2. As a result I rewrote my routine to take into account file sharing, but it struck me that I could use the old routine to check if … Continue reading Checking A Database File

Check For TextBox Entries

Rather than looping manually through every TextBox on the Form, I came up with the following: A function with the Form as a single argument. Loop through each control on the Form, (using "For Each Control etc") and if it's a TextBox which is empty, it returns Err.Number = 0. If this is true, I … Continue reading Check For TextBox Entries

VB4 Objects & Memory Considerations

What happened was that I had objects pointing to other objects. To allow navigation back, I had also included pointers back to the 'owner' of the objects. This last thing meant that the objects never got freed, because there was always something referencing them: the members were referenced by the parent, and the parents were … Continue reading VB4 Objects & Memory Considerations

Speeding Character/String Searches With the Like Operator

I have written a simple function called NeedsFiltering which I use to determine if a block of text contains one or more search characters. The function uses the Like operator to determine if one or more characters in the specified range exist in the input string. If the routine returns False, the text block can … Continue reading Speeding Character/String Searches With the Like Operator

Save Disk Space With VB4 Setup Wizard

These files are used to register you program with the Registration Database. The problem is that the files are not needed! When you compile your OLE server, VB compiles code into it that will do this for you! The problem is that MS does not make this easy for you to find. Because the want … Continue reading Save Disk Space With VB4 Setup Wizard

Running Programs At StartUp

Run Programs During Windows StartUp Find the key:HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run Add a new String Value. Give the value any name, usually the name of the program. Then double-click on it and type in the path, file name and any command line parameters. For example:Value Name = NotepadValue Data = c:\windows\notepad.exe Run Programs When Loading A User Do … Continue reading Running Programs At StartUp

Reducing Control Flicker

These properties are usually ones that cause the control to re-paint, like Enabled, Visible, Caption and Text. The flicker can be easily reduced by not setting a property when it is already set. For instance, if the Enabled property is set to True why set it to True again? Enable/Disable Routine Use this to enable … Continue reading Reducing Control Flicker

How To Keep A Window Always On Top Of All Applications

In order to setup the camera, it is necessary to have the following: Not allow any other windows to be running on top of the application. (On Top is optional) Not allow the application to be re-sized. Not allow the application to be moved. Not have Minimize/Maximize buttons. (Minimize button is optional) Have a visible … Continue reading How To Keep A Window Always On Top Of All Applications

Finding Hard/Floppy/Removable Drives

declare the following in a BAS file:Declare Function GETDRIVETYPE Lib "Kernel" (ByVal nDrive As Integer) As Integer You must pass this function the drive number, not a drive letter. Drive numbers always start a 0. For instance, drive A: is drive #0, Drive C: is drive #2.DRIVETYPE = GETDRIVETYPE(DRIVENUM) This function returns a 2 for … Continue reading Finding Hard/Floppy/Removable Drives

Detecting If Code Is Running In The VB IDE

It relies on the fact that VB removes Debug.Print statements from the compiled EXE. Use Debug.Print to print something that will cause an error. Divide by zero is simple enough.Public Function IsCodeCompiled() As Boolean  On Error GoTo ErrorHandler  Debug.Print 1 / 0  IsCodeCompiled = True  Exit FunctionErrorHandler:  IsCodeCompiled = False  Exit FunctionEnd Function Tip Submitted … Continue reading Detecting If Code Is Running In The VB IDE