|
|
|
|
UniqueWords - Extract all individual words in a string
|
Total Hit (1689) |
«Code LangId=1»
' build a list of all the individual words in a string
'
' returns a collection that contains all the unique words.
' The key for each item is the word itself
' so you can easily use the result collection to both
' enumerate the words and test whether a given word appears
'
....Read More |
Rating
|
|
|
|
SplitTbl - Split a string with multiple delimiters
|
Total Hit (1841) |
«Code LangId=1»' A variant of the Split function, that offers the following improvements
' You can pass a list of valid delimiters to the second argument
' (however, only single-char delimiters are accepted)
' Differently from the regular Split function, consecutive occurrences
' of del
....Read More |
Rating
|
|
|
ExplodeString - Add a filling char between a string's chars
|
Total Hit (2819) |
«Code LangId=1»' "Explode" a string by inserting a given filling character
' between consecutive characters in the original string
'
' The source string cannot contain Chr$(0) characters
Function ExplodeString(Source As String, Optional fillChar As String = " ") As _
String
ExplodeSt
....Read More |
Rating
|
|
|
Tips for debugging MTS components in the VB IDE
|
Total Hit (1545) |
It was and it is still easy to debug MTS components written on Visual C++ version 5 and higher. Debugging components written on Visual Basic 5 is possible under VC IDE. Starting with version 6, Visual Basic allows to debug under its own IDE. Here are the things you should keep in mind while preparin
....Read More |
Rating
|
|
|
Check whether RAS is installed
|
Total Hit (3103) |
When you work with RAS APIs, you should have to make sure if RAS library is installed on the system. A simple way is to verify the existence of the Rasapi32.dll file in the windows system directory; the same thing can be obtained with a call to the InternetGetConnectedState API, as the following cod
....Read More |
Rating
|
|
|
Add pizazz to your apps with an animated cursor
|
Total Hit (3294) |
Who said you can't use an animated cursor with Visual Basic? Actually, it's so simple! You just have to load your animated cursor through LoadCursorFromFile API function, then you get the current cursor using GetCursor, and finally you can set your cursor using SetSystemCursor. This is all the code
....Read More |
Rating
|
|
|
Understanding interface marshaling
|
Total Hit (3576) |
There is quite a lot of misunderstanding among COM newbies about what really happens when a COM interface is passed as a method parameter. As in most of the cases, VB programmers are protected from a lot of details on the COM run-time, but you do have to know such details if you want to assemble som
....Read More |
Rating
|
|
|
Fill a TreeView control with random data
|
Total Hit (2151) |
Every now and then you need to fill a TreeView control with some random data, for example when you want to test a routine and you don't want to write a lot of code just for this secondary task. Here is a recursive routine that does the work for you:
«Code LangId=1»
' MaxChildren is the max num
....Read More |
Rating
|
|
|
Making a form appear as if it is disabled
|
Total Hit (2119) |
By changing the WS_CHILD style bit of a window, you can make it appear as if it is disabled, even if the form is fully active and functional. These are the statements you need:
|
Rating
|
|
|
The beginning or end of previous week
|
Total Hit (3729) |
For reporting, many times you need to figure out what date last week began and ended. Use the code below to figure that out:
|
Rating
|
|
|
Convert Hexadecimal numbers
|
Total Hit (4033) |
While Visual Basic offers the Hex$ function that converts a decimal value into its hexadecimal equivalent number, it seems that the inverse function is missing. Not true. Try out this one-liner:
«Code LangId=1»
Function HexToDec(HexValue As String) As Long
HexToDec = Val("&H" & HexValue)
....Read More |
Rating
|
|
|
Replicate a string of any length
|
Total Hit (2951) |
The String$ function can replicate only 1-char strings, so it seems that you need a loop to duplicate strings that contain 2 or more characters. However, this is a one-liner that does the trick:
«Code LangId=1»
Function ReplicateString(Source As String, Times As Long) As String
' build a s
....Read More |
Rating
|
|
|
Create and verify digital signature to detect data tampering.
|
Total Hit (19084) |
In this article we will talk about digital signature and how to use it to detect any intended/unintended data tampering. Data can be tmpered in many ways it can be intentionally tmpered or it can be currupted during communication or may be some other reason. Anyways today I will show you the use of
....Read More |
Rating
|
|
|
|
|
|
Handling NTFS Permissions Part-5 (handling printer permissions)
|
Total Hit (11004) |
The Win32 Application Programming Interface (API) provides two sets of APIs for working with security descriptors and access control lists (ACLs): low-level and high-level. This series of articles provide a complete set of Microsoft Visual Basic code samples that use low-level access control APIs to
....Read More |
Rating
|
|
|
Use CopyMemory api for performance.
|
Total Hit (4428) |
This article will demonstrate that how CopyMemory can boost the performance of for some simple operations (e.g string append.). Here we will banchmark VB Mid function vs CopyMemory Api.
|
Rating
|
|
|
How to set NTFS permission programatically using Security APIs
|
Total Hit (5310) |
Using security APIs you can set NTFS permissions in more technical term you can change ACL (Access Control List) for a user.
Here for demo purpose I have created a user called "tejuwala" and I have created a folder c:\test and two files c:\test\file_a.txt and c:\file_b.txt . User tejuwala dont ha
....Read More |
Rating
|
|
|
XL97: How to Create a GIF File from a Microsoft Excel Chart
|
Total Hit (3208) |
To programmatically create a graphics file from a Microsoft Excel chart, use the Export method. This article contains a sample Microsoft Visual Basic for Applications macro that creates a .gif file from a chart in a Microsoft Excel workbook.
NOTE: If you click Save As HTML on the File menu and u
....Read More |
Rating
|
|
|
How to Share a Folder using NetShareAdd
|
Total Hit (1437) |
The NetShareAdd function shares a server or workstation resource. Only members of the Administrators or Account Operators local group, or those with Communication, Print, or Server operator group membership can successfully execute the NetShareAdd function. The Print operator can add only Printer qu
....Read More |
Rating
|
|
|
How to Change the ListView Header Style
|
Total Hit (1723) |
Depending on the needs of your application, the standard header font of a listview may prove inadequate for your needs. Unfortunately, the listview API structures and constants do not provide a direct means to specify the font attributes of the header. But by using several standard API functions not
....Read More |
Rating
|
|
|
Using CopyFileEx and Callbacks as a File Backup Mechanism
|
Total Hit (1302) |
So that's how you do it!" This demo shows how to add a callback to the CopyFileEx API that returns the progress of a copying routine. But there is a catch ... CopyFileEx is only available on real operating systems - AKA Windows NT.
|
Rating
|
|
|
|
vbAccelerator ImageList Control and Class v2.0
|
Total Hit (1617) |
As a number of my controls require image list support (Rebar and Toolbar control, Tab Control, S-Grid, Icon Menu Control, ActiveX Popup Menu DLL, Owner Drawn ComboEx Control and the Owner Drawn Combo and List box Control), it was about time I provided an Image List control to support them, so you do
....Read More |
Rating
|
|
|
Panel Selector Control
|
Total Hit (2439) |
This article provides a regional selection control which can be floated over other controls to provide additional options for the selected item. The demonstration then shows how to use the control in conjunction with SGrid 2.0 in hot-tracking mode to provide an interface similar to the lists in the
....Read More |
Rating
|
|