|
|
Protect the form unloading in accidently
|
Total Hit (1524) |
When you want ot protect the form unload in accidently you can use this following code.
In this code, the action is When a form is prepared to
unload The unload event was automatically raised.
on that event there is an parameter named "Cancel" which in the data type integer.
When the unload ev
....Read More |
Rating
|
|
|
|
|
|
|
|
|
|
|
|
ConvertCamelCase - Convert from a string in camel case
|
Total Hit (3495) |
«Code LangId=1»' change a sentence in CamelCase to a sentence with spaces
' for example ConvertCamelCase("FileExchange") => "File Exchange"
Public Function ConvertCamelCase(ByVal Value As String) As String
Dim i As Long
For i = 1 To Len(Trim$(Value))
' If the character is up
....Read More |
Rating
|
|
|
NormRand - Produce random numbers with normal distribution
|
Total Hit (2501) |
«Code LangId=1»' VBA's intrinsic Rnd function returns numbers evenly
' distributed between 0 and 1. Each number in that
' interval has equal probability of being returned
' for any given function call.
' This function NormRand returns a random number between
' -infinity and +infinity distib
....Read More |
Rating
|
|
|
Never use New to create MTS/COM+ objects
|
Total Hit (1883) |
A common question among VB developers is: Why is it dangerous the use of the New keyword in VB to create COM objects registered under MTS/COM+?
The New keyword is the only way to go when you want to create objects that are defined as PublicNotCreatable or Private (CreateObject doesn't work) insid
....Read More |
Rating
|
|
|
Connect a stand-alone Recordset to a database using XML
|
Total Hit (3439) |
If you are familiar with the ADO capability to create stand-alone Recordsets from the thin air, that is by adding items to their Fields collection, you're also probably aware that this feature has a serious shortcoming: you can't then connect to a database and perform any batch updates. The problem
....Read More |
Rating
|
|
|
Combine Default attribute with other attributes
|
Total Hit (3373) |
When building an ActiveX control, you can set a default property or method using the Procedure Attributes dialog box, after clicking on the Advanced button. However, if your default property also happens to require another special attribute - as is the case with Caption and Text properties-you're in
....Read More |
Rating
|
|
|
Detect whether a field on a form has been edited
|
Total Hit (2045) |
Many tip & trick collections report that you can learn if the contents of a text box has been modified by sending a EM_GETMODIFY message to the control. Actually, getting this information is much more simple. Just test the DataChange property: if non zero the field has been modified since the form w
....Read More |
Rating
|
|
|
Hide and Show a control's scrollbars
|
Total Hit (3333) |
Most VB controls don't let you determine whether they should display a scrollbar or not. For example, a VB ListBox control displays a vertical scrollbar only when the number of its items is larger than the number of visible items. If you want to directly control individual scrollbars, you can use th
....Read More |
Rating
|
|
|
Use function name as a local variable
|
Total Hit (3401) |
Many programmers don't realize that it is perfectly legal to use the name of a function inside the Function itself, as if it were a local variable. This trick often lets you avoid the declaration of a temporary variable, and sometimes can speed up the code. Take for example the following code:
«
....Read More |
Rating
|
|
|
|
How to Add/Remove NT group programatically
|
Total Hit (4130) |
This article will show you use of NetGroupAdd and NetGroupDel API to add/remove NT user group.
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 Window
....Read More |
Rating
|
|
|
|
Handling NTFS Permissions Part-2 (handling user object permissions)
|
Total Hit (11538) |
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
|
|
|
HOWTO: Use the Spreadsheet Web Component with Visual Basic
|
Total Hit (2375) |
You can add the Office Web Components to a form in Visual Basic in the same way that you add any other ActiveX control. The Spreadsheet control included with the Office Web Components is a more robust option than the DataGrid control that ships with Visual Basic. Use the spreadsheet data to display
....Read More |
Rating
|
|
|
Determining a ListView's Visible Item Count
|
Total Hit (1774) |
This shows a quick call you can add to any ListView code to determine the number of currently-visible ListItems in the control when in Report mode. By calling SendMessage with the LVM_GETCOUNTPERPAGE message, the call returns the number of items that can be completely contained in the visible area o
....Read More |
Rating
|
|
|
Enumerating Windows Fonts by Type
|
Total Hit (948) |
This page shows the code required to add to a listbox only the specifictypes of fonts desired. Windows supports four font type - Vector (such as Modern), Raster (MS Sans Serif), Device-Specific (such as PostScript), and TrueType
|
Rating
|
|
|
Saving Pictures to JPG Files Using GDI+
|
Total Hit (772) |
Although unfortunately Intel have discontinued support of their IJL library, Microsoft's GDI+ redistributable provides a way for VB coders to work with other file formats fully legitimately; and as a bonus you can also support PNG, TIF and GIF files too. This link redirects you to the new GDI+ file
....Read More |
Rating
|
|
|
Creating drop-down tool windows
|
Total Hit (2027) |
One feature I've been trying to achieve since I first discovered you could write API declares in VB3 (oops, showing my age here...) is a drop-down tool window you can show in response to a button or tool bar button click. These windows have been increasing in number in the Office series of tools and
....Read More |
Rating
|
|
|
WinZip UI Style Sample
|
Total Hit (1454) |
This sample demonstrates using the CommandBar controls to create a WinZip-style user interface. It shows how to set up an Image List to read images from a resource-only DLL and picking icons with the correct colour depth for the host system. It also demonstrates using a context menu to customise the
....Read More |
Rating
|
|
|
Using RC.EXE
|
Total Hit (1661) |
This article provides a short look at how to use the Resource Compiler (RC.EXE) to create resource files (.RES) for Visual Basic applications. Using RC.EXE directly is often better than using the wizards provided with VB5 and 6 as you have more control over including arbitrary data; in addition the
....Read More |
Rating
|
|