|
|
|
|
 |
IsFormModal - Determines whether a form is modal
|
Total Hit (2199) |
«Code LangId=1»
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Const GWL_STYLE = (-16)
Const WS_DISABLED = &H8000000
' Return True if the form is modal
'
' Note: if an application has only one visible
'
....Read More |
Rating
 |
|
 |
ExplodeForm - Show a form with an explode effect
|
Total Hit (1958) |
«Code LangId=1»
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
' Show a form with an explosion effect.
' the lNumSteps parameter is the number of steps to increase the form size from
' 0 to the original size
' the lStepDuration argument is the number of milliseconds
....Read More |
Rating
 |
|
 |
LongPathName - Convert a 8.3 file name to long format
|
Total Hit (2269) |
«Code LangId=1»Private Declare Function GetLongPathName Lib "kernel32" Alias _
"GetLongPathNameA" (ByVal lpszShortPath As String, _
ByVal lpszLongPath As String, ByVal cchBuffer As Long) As Long
Const MAX_PATH = 260
' Convert a short file/path name to a long name
' the file or path
....Read More |
Rating
 |
|
 |
SetFileSize - Trim or extend a file's size
|
Total Hit (2780) |
«Code LangId=1»
Option Explicit
Private Declare Function CreateFile Lib "kernel32" Alias "CreateFileA" (ByVal _
lpFileName As String, ByVal dwDesiredAccess As Long, _
ByVal dwShareMode As Long, lpSecurityAttributes As Any, _
ByVal dwCreationDisposition As Long, ByVal dwFlagsAndAt
....Read More |
Rating
 |
|
 |
IsValidPhoneField - Check whether a phone number is valid
|
Total Hit (1760) |
«Code LangId=1»' Validate attributes of Phone data
' Returns True if valid, False if invalid
'
' Also returns the phone in formatted fashion (USA format).
' Will convert alphabetics to numeric
'
'Example:
' If IsValidPhoneField(Value:="3034414444", ReformattedPhone:=strNewPhone,
' '
....Read More |
Rating
 |
|
 |
CompareValue - Check whether a value is in a list of values
|
Total Hit (1950) |
«Code LangId=1»' Compares a numeric or string value with a list of other values.
' Returns the 1-based index of the matching value, or zero if the
' value doesn't appear in the list.
' String comparisons are case-sensitive.
'
' This function can conveniently replace a Select Case or a list
'
....Read More |
Rating
 |
|
 |
Retrieve the length of a media file (WAV, AVI, MIDI)
|
Total Hit (5868) |
You can retrieve the length of a standard windows media file (WAV, AVI or MIDI) using simple MCI functions. First, you must open the file with:
«Code LangId=1»
Declare Function mciSendString Lib "winmm" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal lpstrReturnString As Strin
....Read More |
Rating
 |
|
 |
Detect when a new control is added to an ActiveX container
|
Total Hit (2840) |
You can easily create ActiveX controls that work as containers for other controls, by setting their ControlContainer property to True. However, VB doesn't offer any event for detecting when the programmer adds or remove controls to the ActiveX control, after placing it on a form's surface.
It's p
....Read More |
Rating
 |
|
 |
Send HTML Email via CDO
|
Total Hit (4245) |
Ever wonder how to send email that looks like a web page? Here is how you do it. Note: You must have CDO for NT referenced for this to work.
«Code LangId=1»
'Sends an email to the appropriate person(s).
'
'From = Email address being sent from
'SendTo = List of email addresses separated by a s
....Read More |
Rating
 |
|
 |
Changing the current record using bookmarks
|
Total Hit (2557) |
If you try to use a DataList and some labels or text boxes linked to an ADO Data control, and you click on some items in the list, you'll notice that the data in the labels won't change, because the current record isn't changed.
To have the code work correctly, you have to write code in the Clic
....Read More |
Rating
 |
|
 |
The behavior of the LostFocus event depends on VB version
|
Total Hit (1803) |
The behavior of the LostFocus event has changed in the transition from VB4 to VB5. Under VB4, if a control on a form has the input focus and the user clicks on a toolbar button, the control fires a LostFocus event. Under VB5 and VB6, the same action doesn't fire any LostFocus event, so you must awar
....Read More |
Rating
 |
|
 |
Unload a form with shrinking effect
|
Total Hit (1704) |
A simple way to add some pizazz to your forms is by minimizing them and then closing them, instead of making them disapper istantaneously. Just try this code:
«Code LangId=1»
Private Sub Form_Unload(Cancel As Integer)
Me.WindowState = vbMinimized
End Sub
«/Code»
....Read More |
Rating
 |
|
 |
Evaluate the number of days remaining in the current year
|
Total Hit (3064) |
The DatePart() function can return the number of days from the beginning of the current year, but there is no VB built-in function that returns the number of days left to the end of the year. You can work around this with the DateDiff function:
«Code LangId=1»
' aDate contains a valid date
Days
....Read More |
Rating
 |
|
|
|
 |
How to display different control panel applets
|
Total Hit (3384) |
«code LangId=1»' Display the Control Panel
Call Shell("rundll32.exe shell32.dll,Control_RunDLL", vbNormalFocus)
'Display the Accessibility Properties
Call Shell("rundll32.exe shell32.dll,Control_RunDLL access.cpl", vbNormalFocus)
'Display Add/Remove Programs
Call Shell("rundll32.exe shell32
....Read More |
Rating
 |
|
 |
HTTP file upload from VB
|
Total Hit (3191) |
This ActiveX control allows users to submit a file to a Web server. This component uses the WinSocket control to submit files using the file transfer protocol (FTP). It only worked in Internet Explorer 3.02 and higher, and several clients used Netscape, so I had to find another solution.
....Read More |
Rating
 |
|
 |
Using the ListView Checkbox
|
Total Hit (1305) |
By popular demand, here are several methods you can employ to perform a variety of ListView check box-related operations.
Setcheck: turns on the checkbox for the item passed as the value in the textbox.
GetChecked: displays a MsgBox with a list of currently-selected checked items and their List
....Read More |
Rating
 |
|
 |
Duplicating the Contents of a Treeview
|
Total Hit (1490) |
The three routines below combine to produce an effective way to duplicate a TreeView with all its data. No API is used, yet the method executes quite quickly. To maximize speed when copying large treeviews, set the receiving treeview's visible property to False before beginning the copy.
The meth
....Read More |
Rating
 |
|
 |
Creating a Common Control Header via the API
|
Total Hit (1014) |
If you're like myself, you've probably wished that some of Visual Basic's other controls provided the look (and functionality) of a ListView's header. In this example, we'll use the API to create a real header control and position it overtop a list or textbox.
....Read More |
Rating
 |
|
 |
Office/VS.NET Style Flat Combo Boxes
|
Total Hit (1777) |
This project provides a class which subclasses Combo Boxes and other controls so that they draw in a flat style and highlight when the mouse is over or they are in focus. The class works on all types of Combo and ComboBoxEx controls as well as on TextBoxes and PictureBoxes. By default, the Office 10
....Read More |
Rating
 |
|
 |
vbAccelerator Progress Bar Control
|
Total Hit (1573) |
This control provides a highly flexible Progress Bar control with an array of drawing styles, including XP Style, segmented/non-segmented, bitmap bars and backgrounds and more. Alternatively, if you don't want the convenient packaging and design-time property settings provided by a control, you can
....Read More |
Rating
 |
|
 |
Window Shapes Using Layering
|
Total Hit (2549) |
This article provides an alternative, higher-performance way of creating a custom-shaped Windows region from a bitmap for Windows 2000 and XP systems. Prior to Windows 2000, window shapes could only be customised using the SetWindowsRgn API. In Windows 2000 and above support the Layered Windows APIs
....Read More |
Rating
 |
|
 |
Unzipping files using the free Info-Zip Unzip DLL with VB
|
Total Hit (1924) |
This article provides a fully featured unzip application written in VB, using the capabilities of the Info-ZIP Unzip DLL. The zip application demonstrates the abilities of the unzip DLL to handle all aspects of unzip operations - password protection, directory listing, including directories whilst u
....Read More |
Rating
 |
|
 |
The vbip.com FtpClient source code library
|
Total Hit (2016) |
The FtpClient library is a set of the code and class VB modules that provides the VB developers with the tool for implementing FTP client functionality into their applications. This is not the old ugly CFtpConnection class (that by the way is still available for download). The main module of the lib
....Read More |
Rating
 |
|
|