|
|
|
|
|
|
|
|
|
ForceTextBoxNumeric - Create a numeric Textbox
|
Total Hit (2260) |
«Code LangId=1»
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" _
(ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long)
....Read More |
Rating
|
|
|
|
|
IsPrime - Determine whether a number is prime
|
Total Hit (1575) |
«Code LangId=1»
' Return True if the number is prime
Function IsPrime(ByVal number As Long) As Boolean
' manually test 2 and 3
If number > 3 Then
If number Mod 2 = 0 Then Exit Function
If number Mod 3 = 0 Then Exit Function
End If
' we can now avoid to consi
....Read More |
Rating
|
|
|
IsValidSSN - Check a Social Security Number value
|
Total Hit (3085) |
«Code LangId=1»' Validates attributes of the SSN
' Returns True if valid, False if invalid
'
'Example:
' If IsValidSSN(Value:="333-44-3333", IsRequired:=True) then ...
Function IsValidSSN(ByRef Value As String, Optional ByVal IsRequired As Boolean _
= True) As Boolean
On Error
....Read More |
Rating
|
|
|
Avoiding Access Denied erros when raising events from MTS objects
|
Total Hit (3056) |
If you don't take specific actions, you get an Access Denied Error when you try to raise an event from an MTS component into a client. This happens because the client executable doesn't have the proper DCOM security settings to let the server call it back. In order to have it working you have two so
....Read More |
Rating
|
|
|
Register and unregister components with context menus
|
Total Hit (3185) |
The stardard method to register and unregister ActiveX component is running the REGSVR32 utility, which forces you to bring up the Start|Run dialog and manually type the command line. A much better approach is to have the Register and Unregister commands right in the context menu that appears when y
....Read More |
Rating
|
|
|
Use DataChanged with unbound controls
|
Total Hit (1928) |
When you need to learn if a field has been changed by the user, you have at least three options:
you can use a global boolean variable and set it in the control's Change event, or
you can save the original value in global variable to compare it against the current value
you can use the EM_GE
....Read More |
Rating
|
|
|
Create arrowed buttons without icons
|
Total Hit (3914) |
You don't need to use icons or bitmap to create buttons with arrows on them. In fact, you just have to select the "Windings" font, set a suitable font size (e.g. 12 or 14 points), and then enter one of these characters:
«Code LangId=1»
Line arrows
Chr$(223) Left Arrow
Chr$(224) Right Arrow
Chr
....Read More |
Rating
|
|
|
|
Very simple Encryption/Decryption code using VB
|
Total Hit (4688) |
This code will show you how to encrypt/decrypt a string.
Copy/Paste the following code in your VB form and press F5 to run.
«code LangId=1»Const ENCRYPTION_KEY = "MySecreteKey123"
Private Sub Form_Load()
Dim txt As String, enctxt As String
txt = "Your password is : asd$223"
....Read More |
Rating
|
|
|
How to create pattern brush from bitmap or picture object ?
|
Total Hit (6436) |
In this article we will learn how to use CreatePatternBrush along with CreateBitmap API. CreateBitmap can be used to create a memory bitmap of specified width, height and Bits/Pixel. CreatePatternBrush can create a pattern brush based of Bitmap. You can also use VB Picture object as a bitmap handle.
....Read More |
Rating
|
|
|
How to list all available timezones and change the timezone?
|
Total Hit (6639) |
It is sometimes necessary to programmatically change the time zone for the system where the application is running. This article demonstrates this technique.
The way to implement this effect is as follows:
Determine which time zone you would like to change to.
Find the key in the registry tha
....Read More |
Rating
|
|
|
How can I print a preformated file directly to printer?
|
Total Hit (2610) |
«b»Step-By-Step Example«/b»
1. On a Microsoft NT 4.0 system, add a printer with a name that contains a space.
2. Create a text file in the C:\ folder, for example, test.txt.
3. Start a new Standard EXE project in Visual Basic. Form1 is created by default.
4. From the Project menu, select Refer
....Read More |
Rating
|
|
|
Centering the Open & Save Common Dialogs Using Callbacks, Advanced
|
Total Hit (1224) |
Centering the Open & Save Common Dialogs Using Callbacks showed just how simple implementing a window hook for the OPENFILENAME structure can be. Here we expand upon that same code to provide additional positioning options - centred to the screen, to the parent form, or allow the dialog to take its
....Read More |
Rating
|
|
|
VB Programmer's AVIFile Function Help Pages
|
Total Hit (1162) |
Windows contains a powerful set of video file functions called the AVIFile API ('Application Programming Interface'). The AVIFile API set of functions is part of an even larger API called the Video For Windows API. It is possible to use the AVIFile functions from Visual Basic. However, the lack o
....Read More |
Rating
|
|
|
Cellular Automata - Crystal Model
|
Total Hit (1194) |
A cellular automata are a class of mathematical systems which have been used widely in the investigation of complexity. An automaton is simple: an array of neighbouring cells each have a finite number of possible states. Each cell is then set to change its state when an imaginary clock ticks accordi
....Read More |
Rating
|
|
|
MusicLibrary SGrid Sample
|
Total Hit (2282) |
This sample uses SGrid 2.0 along with the MP3 Tags code to load, display and persist a Music Library. It allows library import, sorting, grouping and in the future should be upgraded to include tag editing and play functions. It has been successfully used with over 7,000 tracks.
....Read More |
Rating
|
|
|
Sophisticated Control Over Window Sizing and Moving
|
Total Hit (1978) |
VB's control over moving and sizing isn't much - basically you have the Resize event, as has been the case since VB1. Windows gives you a lot more control over moving and sizing forms if you need it though. For example, try resizing an undocked tool window in MS Office. You will see that the size sn
....Read More |
Rating
|
|
|
Adding XP Visual Styles to Your Visual Basic Application
|
Total Hit (1983) |
When you run a Visual Basic application on an XP machine, you will see that although the form gets an XP-style title bar, the controls on the form still draw in the old-fashioned Windows style. However, it doesn't take much to persuade an application to use the new styles. In some cases, you can get
....Read More |
Rating
|
|
|
Browsing For Folders
|
Total Hit (2009) |
The Folder Browse Dialog is the missing dialog in VB - it can't be called from a run-time function and it is missing from the Common Dialog OCX as well. Whilst a number of code samples demonstrate that calling this dialog is simple, many ignore the most important feature: the ability to initialise t
....Read More |
Rating
|
|
|