|
How To Automate Microsoft Excel from Visual Basic
|
Total Hit (3868) |
There are two ways to control an Automation server: by using either late binding or early binding. With late binding, methods are not bound until run-time and the Automation server is declared as Object. With early binding, your application knows at design-time the exact type of object it will be co
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
|
Disable COM+ 1.5 applications and components
|
Total Hit (2956) |
COM+ 1.5 (provided with Windows XP) has an interesting feature that is missing in COM+ 1.0: the ability to disable entire COM+ applications or just their individual components. You can disable and re-enable a COM+ application or component by right-clicking on it in the Component Services MMC explore
....Read More |
Rating
|
|
|
Check for a valid URL
|
Total Hit (4078) |
Before posting an Internet request you should check that the user has entered a valid Internet address. You can do this with a parsing routine, or use the following routine based on the IE5 library:
«Code LangId=1»
Private Declare Function IsValidURL Lib "urlmon" (ByVal pBC As Long, _
url A
....Read More |
Rating
|
|
|
Convert a color value to a gray scale
|
Total Hit (3360) |
When you have a 32-bit color value, you can convert it to a grey-scale - that is, you can determine how it would appear on a monochromatic display (more or less) using the following function:
«Code LangId=1»
Function GetGreyScale(ByVal lColor As Long)
lColor = 0.33 * (lColor Mod 256) + 0.59
....Read More |
Rating
|
|
|
Topmost windows
|
Total Hit (2150) |
This is an evergreen, but it's still popular. It is very easy to create a window that always stays on top of the others, thanks to the SetWindowPos API function. Here is a general procedure that can be called to make a form the topmost window and to revert to the normal status. This capability is ex
....Read More |
Rating
|
|
|
UseMnemonics property for bound Label controls
|
Total Hit (2253) |
If your forms contain Label controls used to display data from a database, set their UseMnemonic property to False. In fact, if you leave this property to its default value (True), ampersand "&" characters won't be showed correctly, and the Label will mistakenly react to hotkeys.
....Read More |
Rating
|
|
|
The age of a person
|
Total Hit (2887) |
You can quickly evaluate the age of a person using the following function:
«Code LangId=1»
Function Age(BirthDate As Date, Optional CurrentDate As Variant) As Integer
If IsMissing(CurrentDate) Then CurrentDate = Now
Age = Year(CurrentDate) - Year(BirthDate)
End Property
«/Code»
If
....Read More |
Rating
|
|
|
Understanding the "Allow Unrounded Floating Point Operations" option
|
Total Hit (3008) |
The Microsoft manuals preach that all the compiler options in the Advanced Optimization dialog box are to be considered unsafe, in that they might lead to incorrect results (or just program crashes!). This is true for most of them, but often one of such options - namely, the "Allow Unrounded Floatin
....Read More |
Rating
|
|
|
Tricks with LCase and UCase
|
Total Hit (2918) |
There are a few tricks that you can do with LCase$ and UCase$ functions. I doubt you will be using this tip in all your applications, but here they are for when you'll need them.
Say you wish to check that a string (or a portion of it) does NOT include any alphabetical characters: instead of set
....Read More |
Rating
|
|
|
Evaluate an expression at runtime
|
Total Hit (3682) |
The .NET framework doesn't offer any direct way to evaluate an expression that has been entered by the end user when the application is running. However, it is quite simple to create a simple expression evaluator based on calculated columns in DataTable. The following routine does the trick:
«Cod
....Read More |
Rating
|
|
|
Enumerating Share Connection Information
|
Total Hit (1606) |
The WNetEnumResource API continues enumeration of network resources on the local computer that was started by a call to the WNetOpenEnum API function. It will not retrieve the shares in use on remote machines. The illustration shows the function enumerating all network resources on my development ne
....Read More |
Rating
|
|
|
Using the GetOpenFileName Common Dialog API - Overview
|
Total Hit (1592) |
This page details the descriptions of Windows GetOpenFileName and GetSaveFileName API methods. The related demo code pages show how to call the APIs, as well as demonstrating how to retrieve the constituent parts of the file string returned.
To access both of the file common dialogs, the OPENFILEN
....Read More |
Rating
|
|
|
Adding a VB Toolbar to a VB StatusBar
|
Total Hit (1262) |
This code was prompted by a newsgroup request for code to place a VB command button inside a VB statusbar such that the button reacted normally to events yet was contained inside the status bar panel area. Attempts to use SetParent against the command button worked to re-parent the control, however
....Read More |
Rating
|
|
|
How to Programmatically Select and Deselect All ListItems
|
Total Hit (1482) |
Using conventional methods, selecting and deselecting all items in a ListView typically involves iterating through the ListItems collection to set each item's selected property. By utilizing the SendMessage API with LVIS_SELECTED, this monotony can be reduced to a single call.
Note that this meth
....Read More |
Rating
|
|
|
Changing the Display Resolution from Visual Basic
|
Total Hit (1284) |
This routine, like the ListView method in Enumerating the Available Display Resolutions, uses Windows' EnumDisplaySettings API to retrieve all the available screen resolutions supported by the display. Here, the results are used to create a "QuickRes-style menu", replete with the option of displayin
....Read More |
Rating
|
|
|
|
Make a ComboBox drop down when you press the down arrow key
|
Total Hit (1847) |
Drop-down combo boxes by default drop down when you press the F4 key. However, not many users know this, and you can make a combo box easier to use by making it drop down in response to the down arrow key instead.
|
Rating
|
|
|
Rank Filters
|
Total Hit (775) |
This is a supporting note describing the Rank filter provided in the vbAccelerator Image Processor. Rank filters can either be linear, yielding a softening effect, or non-linear, giving an impressionistic effects to a images.
|
Rating
|
|
|
Using The IconMenu Control To Create a Colour Picker
|
Total Hit (896) |
This project demonstrates how to use the new Caption shortcuts in the Icon Menu control to create multiple column menus which don't have separators. By adding the hat character ("^") to the beginning of a menu caption, the Icon Menu control will start a new menu column without a separator line. (Use
....Read More |
Rating
|
|
|
Subclassing Without The Crashes
|
Total Hit (2548) |
Prior to VB5, it was impossible to subclass a control without relying on a proprietary custom control. This greatly restricted what you could do if you wanted to play around with some of the neater customisation features - creating a new control was completely out, finding out in detail what was goi
....Read More |
Rating
|
|
|
Win32 Hooks in VB - The vbAccelerator Hook Library
|
Total Hit (2649) |
When a subclass isn't tough enough for the job, its time to move to an even lower-level and more disruptive technique. Win32 Hooks are a method by which you can tap into the Windows message stream for every single message directed to every window in your application. You can modify or even discard m
....Read More |
Rating
|
|
|
Introduction to the freeware Info-ZIP libraries
|
Total Hit (1965) |
This project started when I was trying to build up the indexes for the vbAccelerator site. I had a program to search through all the HTML files which make up the site, and this could pick out the ZIP files linked to by the pages. But how to determine which projects these ZIP files contained? You nee
....Read More |
Rating
|
|