|
Getting StdPicture's Width and Height properties in Pixels
|
Total Hit (5135) |
In general, Visual Basic doesn't provide a way to determine the size of a bitmap loaded into a PictureBox control. But you can derive this information if you set the control's AutoSize property to True and then read the control's ScaleWidth and ScaleHeight properties. If you don't want to resize a v
....Read More |
Rating
|
|
|
Create and verify digital signature to detect data tampering.
|
Total Hit (19504) |
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 (11222) |
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
|
|
|
|
|
UniqueWords - Extract all individual words in a string
|
Total Hit (1765) |
«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 (1898) |
«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 (2932) |
«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
|
|
|
GetStringBetweenTags - Returns a string between 2 delimiters
|
Total Hit (3105) |
«Code LangId=1»' Returns a string between 2 delimiters
' Parameters:
' sSearchIn: String to search
' sFrom: First keyword
' sUntil: Second keywords
' nPosAfter: Gets the position after
'
' Example:
' Debug.Print GetStringBetweenTags("<html>This is a sample of title</html>",
'
....Read More |
Rating
|
|
|
Tips for debugging MTS components in the VB IDE
|
Total Hit (1612) |
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
|
|
|
Hide or disable the desktop icons
|
Total Hit (3621) |
The Desktop is a window like any other window in the system, so you can hide/show and enable/disable it. The only details you need to know is how to retrieve the handle to the Desktop window. It turns out that this window is the first child window of the "Program Manager" window, so all you need is
....Read More |
Rating
|
|
|
Add pizazz to your apps with an animated cursor
|
Total Hit (3407) |
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
|
|
|
Making a form appear as if it is disabled
|
Total Hit (2197) |
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
|
|
|
Convert Hexadecimal numbers
|
Total Hit (4182) |
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 (3093) |
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
|
|
|
Write concise code with the Switch function
|
Total Hit (1781) |
Many VB developers don't realize that the Switch built-in function can often save a lot of code. This function takes any number of (expr, value) pairs, it evaluates all expressions and return the value related to the first expression that is found to be True. Typically you can use a Switch function
....Read More |
Rating
|
|
|
Manufacture a Missing value
|
Total Hit (3949) |
Visual Basic doesn't provide you with a means for creating a Missing value, a feature that in some cases would prove useful in order to simplify the syntax of calls to procedures that expects a variable number of arguments. It isn't difficult, however, to create such a value programmatically, as fol
....Read More |
Rating
|
|
|
XL97: How to Create a GIF File from a Microsoft Excel Chart
|
Total Hit (3318) |
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 Change the ListView Header Style
|
Total Hit (1827) |
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
|
|
|
Disabling the Combo Edit Box
|
Total Hit (1441) |
OK, so you have a combo (Style 0) where you want to allow the user the ability to copy the contents, but not change the text. Setting the combo's locked property will do the trick, but the right-mouse context menu is still available. This shows how using FindWindowEx and SendMessage with the EM_SETR
....Read More |
Rating
|
|
|
Creating a Custom PhotoShop-Style ProgressBar in a MDI App
|
Total Hit (1020) |
The routine here is based on code originally developed to overcome some of the display limitations of the original VB3 SSPanel FloodPercent control, namely justification of text and positioning as a member inside a status panel. The routine was originally developed in VB3, and has been updated for u
....Read More |
Rating
|
|
|
Presenting a Non-Selectable 'No Data' Picture in a ListBox
|
Total Hit (1718) |
The VBnet page Customizing the ListView's Appearance via API showed how to use SendMessage with the LVBKIMAGE structure to display images in the data window of a listview control. Although Windows' normal list box does not support such functionality, we can still fake this functionality using the B
....Read More |
Rating
|
|
|
|
|
Adding, Deleting and Viewing Recent Documents
|
Total Hit (1055) |
This sample demonstrates how to add, read and clear the Shell's Recent Document List from VB code. At the same time, it provides a useful ShellLink class for working with Shortcuts.
|
Rating
|
|
|
Animated Cursors in VB
|
Total Hit (1853) |
Nice feature in Office - you can set it to show customised animated cursors. For example, when Office is opening a document the cursor switches to an animation of a yellow handbag throwing up a small piece of paper (I think that's what it is, anyway).
It would be nice to do it this in VB too, yes
....Read More |
Rating
|
|
|
|
CommonDialog/Direct
|
Total Hit (3077) |
Common Dialog/Direct is a new DLL or class library which shows how to completely replace COMDLG32.OCX through Visual Basic code. The main advantage of this is you no longer need to put a control on a form to use common dialogs - just declare an instance of the class and you have a straight replaceme
....Read More |
Rating
|
|