|
|
|
|
|
|
|
FilterDuplicates - Delete duplicate items in an array
|
Total Hit (2252) |
«Code LangId=1»
' Filter out duplicate values in an array and compact
' the array by moving items to "fill the gaps".
' Returns the number of duplicate values
'
' it works with arrays of any type, except objects
'
' The array is not REDIMed, but you can do it easily using
' the following co
....Read More |
Rating
|
|
|
|
PrintF - Transforming template strings
|
Total Hit (1814) |
«Code LangId=1»' This VB6 function returns a string with a set of parameters replaced with
' variables, similar to the C function printf().
Public Function PrintF(strMask As String, ParamArray Values()) As String
On Error Resume Next
' pass in a mask with variables in the order of \0
....Read More |
Rating
|
|
|
Hide or disable the Windows' application bar
|
Total Hit (3279) |
The Windows' application bar (or Startbar) is a window like any other window in the system, so you can hide/show and enable/disable it. The only thing you need to know is that that the class name of the Start bar window is "Shell_TrayWnd" and that its window name is a null string. Here is the code t
....Read More |
Rating
|
|
|
Rebase compiled DLLs
|
Total Hit (3395) |
Many VB developers know that they should specify a DLL Base Address value - in the Compile tab of the Project Properties dialog box - that is different from the base address of any other DLL or OCX used in the project.
When you are working with a compiled DLL or OCX for which you don't have the
....Read More |
Rating
|
|
|
Determine the optimal width for ListView columns
|
Total Hit (3098) |
Here's a simple but effective trick to ensure that the column of a ListView control is wide enough to display the entire string you're assigning to the column title or to an element. Just drop a Label on the form, set its Autosize property to True and Visible property to False. Also, ensure that the
....Read More |
Rating
|
|
|
Get full control on the text typed in a TreeView's node
|
Total Hit (3806) |
The TreeView control exposes the AfterLabelEdit event to let the programmer validate the text entered in a Node, but there is no way to trap keys as they are typed by the user. This prevents you from discarding unwanted characters while the user types them.
You can work around this problem by sub
....Read More |
Rating
|
|
|
Overwrite mode for textbox controls
|
Total Hit (2426) |
By default, textbox controls work in insert mode, where each new character never overwrites existing ones. If you wish to implement overwrite mode you can take advantage of the fact that characters pressed by the user replace the currently selected text, if any.
You need to declare a form-level
....Read More |
Rating
|
|
|
Tricks with DateSerial
|
Total Hit (3270) |
The DateSerial function has an interesting feature: it doesn't raise errors when you pass it an invalid month or day number. Instead, it evaluates the date as if the arguments were valid. For example, DateSerial(2000, 1, 32) returns the Date value of February 1, 2000. This behavior can (and should)
....Read More |
Rating
|
|
|
Search multiple substrings with the RegExp object
|
Total Hit (3910) |
The RegExp object in the Microsoft VBScript Regular Expression type library supports regular expression patterns containing the | (or) operator, which lets you search for multiple substrings at the same time. For example, the following piece of code lets you search for a month name in a source text:
....Read More |
Rating
|
|
|
Quick comparison among UDTs
|
Total Hit (4305) |
When you need to compare two User Defined Type (UDT) variables to check whether they are equal, the only approach that you can follow in plain VB is to compare each individual element of the UDT. For example, say that you have the following Type declaration:
«Code LangId=1»
Private Type MyUDT
....Read More |
Rating
|
|
|
Simplify your code with Inc and Dec functions
|
Total Hit (3550) |
Unlike other languages - such as C and Delphi - VB lacks of the capability to increment and decrement a variable. Adding this feature, in the form of reusable Function routines, is simple:
«Code LangId=1»
Function Inc(Value As Variant, Optional Increment As Variant = 1) As Variant
Value = V
....Read More |
Rating
|
|
|
Move Form without title bar (2 different methods)
|
Total Hit (4030) |
You can move a form which has no titlebar by 2 different methods. First method will not show any drag border while second method will show drag borders.
«code LangId=1»'//////////////////////////////////////////////////////////
'// Move Form Without Title bar (Method-1: Without drag border)
'////
....Read More |
Rating
|
|
|
How to set default printer programatically on Win 9x/NT ?
|
Total Hit (4551) |
This article shows how to programmatically set which printer is the system default printer. Not all applications or components can select a specific printer to use. This often makes it necessary to change the default printer for the system so that the application or component will use the desired pr
....Read More |
Rating
|
|
|
|
How to run an AVI inside a PictureBox control
|
Total Hit (3641) |
API Declarations
«Code LangId=1» Const WS_CHILD = &H40000000
Private Declare Function mciSendString Lib "winmm.dll" Alias _
"mciSendStringA" (ByVal lpstrCommand As String, _
ByVal lpstrReturnString As String, ByVal uReturnLength As Long, _
ByVal hwndCallback As Long) As Lon
....Read More |
Rating
|
|
|
Introduction to the Winsock API Test Bench sample application : Winsock API - Step by step tutorial for the Visual Basic developers
|
Total Hit (4261) |
The second part of the Winsock API tutorial is to introduce the following functions: accept, bind, closesocket, connect, getpeername, getsockname, getsockopt, listen, recv, select, send, setsockopt, socket. We'll learn these functions by creating the Winsock API Test Bench sample application.
....Read More |
Rating
|
|
|
Centering the Open & Save Common Dialogs Using Callbacks
|
Total Hit (1140) |
The Common Dialog API provides a simple and powerful replacement to the Common Dialog control for projects using the file open or save methods. Not burdened by the baggage of properties, the API solutions also offer a significant performance increase. And all this comes in calls that still allow man
....Read More |
Rating
|
|
|
|
Get System Display Fonts and Non-Client Area Sizes
|
Total Hit (2705) |
The Non-Client area of a window is defined as the area you don't draw on; i.e. the window border, caption, menu bar and scroll bars. Whilst it is easy to get the colours that Windows uses to display these items (the VB enumeration SystemColorConstants supplies all the OLE_COLOR versions of these col
....Read More |
Rating
|
|
|
Brightness and Contrast
|
Total Hit (1741) |
This article demonstrates how to apply two of the simplest image processsing filters, brightness and contrast, to an image.
|
Rating
|
|
|
Owner-Draw Cells with SGrid 2.0
|
Total Hit (2620) |
This sample demonstrates implementing the IOwnerDrawGridCell interface for SGrid 2.0 to create customised cells within a grid. Two easy to re-use examples are provided: a colour indicator and a progress bar.
|
Rating
|
|
|
Displaying Alpha (32bit) Icons with ImageLists
|
Total Hit (1979) |
Version 6 of ComCtl32.DLL (shipped with Windows XP) supports icons with alpha channels. This article describes how you can use icons with alpha channels with the vbAccelerator Image Lists.
|
Rating
|
|
|
XML Property Bag
|
Total Hit (1460) |
This ActiveX DLL is derived from an excellent original XML PropertyBag sample by Aaron Anderson (Aaron.Anderson@mail.farmcreditbank.com). It allows you to persist and recreate your own objects directly to XML based-files using a simple interface closely related to VB's PropertyBag object. By impleme
....Read More |
Rating
|
|