|
|
|
|
|
JoinQuoted - A Join variant that encloses string values in quotes
|
Total Hit (1606) |
«Code LangId=1»' Join variant that works with arrays of any type
' and that encloses string values between quotes
'
' ARR is the array whose element must be joined
' SEPARATOR is the separator char (default is comma)
' QUOTED is the character used to quote string values
' use a two-char st
....Read More |
Rating
|
|
|
|
FormatPhoneNumber - Format a phone number
|
Total Hit (3011) |
«Code LangId=1»' Modify a phone-number to the format "XXX-XXXX" or "(XXX) XXX-XXXX".
Function FormatPhoneNumber(ByVal text As String) As String
Dim i As Long
' ignore empty strings
If Len(text) = 0 Then Exit Function
' get rid of dashes and invalid chars
For i
....Read More |
Rating
|
|
|
LowWord - The least significant word of a Long value.
|
Total Hit (2091) |
«Code LangId=1»Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (dest As _
Any, source As Any, ByVal bytes As Long)
' Return the low word of a Long value
Function LowWord(ByVal value As Long) As Integer
CopyMemory LowWord, value, 2
End Function
«/Code»
....Read More |
Rating
|
|
|
Make COM objects in a COM+ application visible to clients
|
Total Hit (1731) |
What I describe for COM+, applies to MTS with some slight differences as well.
Registering COM objects remotely has been quite a pain before MTS showed up (remember the VBR file?). In COM+ it's very easy to do:
1) Right click on the COM+ application and choose export Choose application proxy,
....Read More |
Rating
|
|
|
How did Windows start?
|
Total Hit (2981) |
If you need to know how Windows was started you have just to call an API function: GetSystemMetrics. Passing the SM_CLEANBOOT constant as parameter, the function returns a Long value with this meaning:
«Code LangId=1»
0 = Normal boot
1 = Fail-safe boot
2 = Fail-safe with network boot
«/Code»
....Read More |
Rating
|
|
|
Quickly copy field attributes when creating tables
|
Total Hit (2956) |
Under VB6 you can create new SQL Server and Oracle tables - but not MDB tables - without leaving the environment. You only have open the DataView window, right-click on the Tables folder of a database, and select the New Table mennu command.
When working with similar tables, that is tables with m
....Read More |
Rating
|
|
|
Test for Leap Year
|
Total Hit (3217) |
As long as you trust VB's IsDate function (and you can, trust me), here's the shorted and fastest method to check if a year is a leap year or not:
«Code LangId=1»
Function IsLeapYear(year As Integer) As Boolean
IsLeapYear = IsDate("2/29/" & CStr(year))
End Function
«/Code»
Here's is anot
....Read More |
Rating
|
|
|
|
Swap strings the fast way
|
Total Hit (3236) |
Consider the usual way of swapping two strings:
«Code LangId=1»
Dim s1 As String, s2 As String
Dim tmp As String
' initialize the strings
s1 = String$(1000, "-")
s2 = String$(1500, "+")
' do the swap, through a temporary variable
tmp = s1
s1 = s2
s2 = tmp
«/Code»
If you put the abo
....Read More |
Rating
|
|
|
Write concise code with the IIf function
|
Total Hit (2134) |
Use IIf when setting a value based upon an expression. This works only in situations where you have two choices, based upon the result of a Boolean expression.
«Code LangId=1»
'long way
If Var1 > Var2 Then
Var3 = Var1 / Var2
Else
Var3 = Var2 / Var1
End If
'this is more concise
Var
....Read More |
Rating
|
|
|
Items of ParamArray can be Missing
|
Total Hit (3328) |
When using the ParamArray keyword within a procedure, always remember that when the procedure is invoked from elsewhere in the program one of the argument might be omitted, and you should keep this into account. Here is an example of a routine that uses ParamArray:
«Code LangId=1»
Function Max(
....Read More |
Rating
|
|
|
Very simple way to create transparent image using API
|
Total Hit (2529) |
If you ever need to create transparent BMP then don't worry here is an API which makes your life easy. To make this demo simple I have avoided color selection. In this demo default transparent color is first left top pixel color of source image.
«b»Step-By-Step Example«/b»
- Create a standard
....Read More |
Rating
|
|
|
How to Add/Remove NT user account programatically
|
Total Hit (5504) |
This article will show you use of NetUserAdd and NetUserDel API to add/remove useraccount.
Windows NT and Windows 2000 exposes LanMan 32-bit Application Programming Interfaces (APIs) to provide network services. These APIs are called only from 32-bit programs running on a Windows NT or Windows 20
....Read More |
Rating
|
|
|
|
Obtaining Processor Information using WMI
|
Total Hit (1324) |
Windows Script Host is built into Microsoft Windows 98, 2000, ME and XP. If you are running Windows 95 or NT4, you can download Windows Script Host from the Microsoft Windows Script Technologies Web site at http://msdn.microsoft.com/scripting/. Some information is not returned on non-NT-based system
....Read More |
Rating
|
|
|
|
How to Display Grid Lines in a ListView
|
Total Hit (1228) |
By setting a ListView extended style bit using the API SendMessage with the message LVS_EX_GRIDLINES, the ListView columns and rows will be separated by a grey grid line.
|
Rating
|
|
|
EnumWindows and EnumChildWindows Callbacks
|
Total Hit (1587) |
Many Windows' Enum APIs provide callback data for specific tasks.
This project demonstrates using both EnumWindows and EnumChildWindows APIs and their respective EnumWindowProc and EnumChildProc callbacks. The main form in the demo enumerates all top-level windows on the system populating ListView
....Read More |
Rating
|
|
|
Changing Colours of a VB ProgressBar
|
Total Hit (1376) |
Here's a quick SendMessage method to change the bar and / or backcolours of both a VB5 or VB6 progress bar, or an API-created progress bar. Note that on XP, using the 'Silver' theme, the default bar colour is grey, not the usual blue.
|
Rating
|
|
|
|
Add a Check Box to the Left Hand Side of a Drop-Down Combo Box
|
Total Hit (1781) |
In Microsoft's Outlook Express, there is a find window which allows you to set a date range to search in. You turn this date range on and off by clicking a check box which is embedded in the left hand side of the combo box. The text of the combo box is moved to the left to accommodate the check box.
....Read More |
Rating
|
|
|
Change The Width of Items in a Listbox
|
Total Hit (2373) |
Normally in a VB ListBox, if a ListItem is too long to fit, it is clipped by the display. This tip demonstrates how to modify a ListBox so it displays a longer items with a horizontal scroll bar.
|
Rating
|
|
|
AVI Creation
|
Total Hit (2550) |
One thing that's always been tricky with AVIs is the lack of suitable software to create them. This article provides VB classes allowing 8-bit and 24-bit AVIs to be created, using any available Codec on the system. The demonstration project uses these classes to provide a pretty comprehensive progra
....Read More |
Rating
|
|
|
vbAccelerator TabStrip Control
|
Total Hit (1867) |
This control provides a fully functional implementation of the ComCtl32 TabStrip control. The control implements all the latest features, including support for Owner-Draw tabs, and is entirely coded in VB
|
Rating
|
|
|
Using XML Queries and Transformations
|
Total Hit (1651) |
Professional Visual Basic 6 XML shows the VB community how to take advantage of XML technology and the available (free-to-use) implementations. The flexible and standards-based data description that XML provides can be used in a myriad of places where VB programmers are active.
To learn more abo
....Read More |
Rating
|
|