Atlanta Custom Software Development 

   Search        Code/Page

User Login



Forgot the Password?
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
VB VB (1648) (736)
C# C# (15) (779)
ASP ASP (41)
VC++ VC++ (25)
JScript JScript (5)
» SQL Server (708)
» ORACLE (5)
» MySQL (0)
» DB2 (0)
» C/C++/ASM (11)
» Microcontroller (1)
» Circuit Design (0)
» Networking (5)
» Unix/Linux (1)
» WinNT/2k/2003 (8)
» Flash (0)
» Maya (0)
» 3D max (0)
» Photoshop (0)
» (2)
» PC Interfacing (1)
» Networking (4)
» SQL Server (4)
» VB (23)
» (4)
» VC (3)
» HTML/CSS/JavaScript (10)
» Regular Expr Tester
» Free Tools

(Page 1 of 2) 52 Result(s) found 


A VarPtr substitute function for VB4
Total Hit (2728) Both VB5 and VB6 include a hidden function, named VarPtr, that returns the address of a variable. Many advanced tricks and routines, on VB2TheMax or other site, use this function. However, VB4 doesn't directly support VarPtr, so it seems that you can't use such routines with those older versions of ....Read More
Count substrings with the Replace function
Total Hit (2531) You can often use the Replace function in a smewhat unorthodox ways to simplify (and sometimes optimize) your code. For example, in order to count the number of occurrences of a substring inside another string you usually need a loop based on the InStr function: «Code LangId=1» Dim i As Long, cou ....Read More
Cross-midnight time measurements
Total Hit (2409) Any time the behavior of your code depends on the Timer function you should take into account the (more or less) remote possibility that your code is executed just before midnight. Take for example the following code: «Code LangId=1» Sub Pause(seconds as Single) Dim initTime as Single ....Read More
Determine whether an ActiveX DLL is being used by an interpreted program
Total Hit (2399) While determine whether the current program is running as interpreted or compiled code is relatively easy, determine whether an ActiveX DLL is serving an interpreted or compiled application is a bit more difficult. This information might be useful to disable or enable special features, or just to pr ....Read More
Determine whether the client program is in break mode
Total Hit (3032) When an interpreted client running in the IDE enters debug (break) mode, all the ActiveX DLL it's using continue to be in run mode as usual, even though you won't notice it because the DLL will be inactive until the program invokes one of its methods. There are times, however, when the DLL is able t ....Read More
Don't use = operator on Date values
Total Hit (2495) Date variables store values in floating point format, much like Double variables, with the integer part for dates and the fractional part for the time portion. Being floating point values, Data values may be subject to rounding problems, and for this reason you shouldn't test two Date variables for ....Read More
Enhanced For-Next loops
Total Hit (2357) At times you may need to execute the same block of statements for different values of a variable, but you can't use a straight For Next loop because the sequence of values is not regular. For example, you may need to repeatedly call a given procedure passing the first ten prime numbers as arguments: ....Read More
Evaluate an expression at runtime
Total Hit (2285) The ".NET framework doesn't offer any direct way to evaluate an expression that has been entered by the end user when the application is running. However, it is quite simple to create a simple expression evaluator based on calculated columns in DataTable. The following routine does the trick: ....Read More
Evaluate an expression at runtime
Total Hit (2227) Function
Evaluate an expression at runtime
Total Hit (2849) The .NET framework doesn't offer any direct way to evaluate an expression that has been entered by the end user when the application is running. However, it is quite simple to create a simple expression evaluator based on calculated columns in DataTable. The following routine does the trick: «Cod ....Read More
Event logging doesn't work in interpreted applications
Total Hit (2769) The StartLogging and LogEvent methods of the App object only work in compiled applications. This behavior is by design and shouldn't be considered a bug, even though it isn't documented in the language manuals. To work around this problem, just create an ActiveX DLL component that exposes the St ....Read More
GoSub are slower in compiled programs
Total Hit (2672) In VB applications compiled as native code, GoSubs are 5-6 times slower than calls to regular Subs or Functions; conversely, in p-code they are considerably faster. This is one of the few examples of an optimization rule that is different in p-code from compiled applications. ....Read More
Hidden Variant variables
Total Hit (2774) Variants are the default type of variables that are declared without an As clause, as in: «Code LangId=1» Dim name ' this is a variant «/Code» or are not declared at all (which is only possible if the current module does not include any Option Explicit statement). If you are recycling progra ....Read More
Implement the CallByName function using the TLI library
Total Hit (4474) Thanks to the undocumented TlbInf32 library you can emulate the VB6 CallByName() function in VB5 too. First, add a reference to the "TypeLib Information" type library in your project. This library contains the InvokeHook function, which is very similar to CallByName. Let's suppose you have an Act ....Read More
Interpreted or Compiled?
Total Hit (3176) It is highly unfortunate that Visual Basic doesn't offer a way to execute a group of statements only when the program is interpreted in the environment or only when it has been compiled (indifferently as native code or p-code) to an EXE file. What we badly need is a conditional compilation constant ....Read More
IsMissing returns False with non-Variant arguments
Total Hit (2928) Every now and then I forget that the IsMissing function always returns False when the argument is not a Variant value. This happens because IsMissing does nothing more than converting its argument to Variant and testing for a special VarType value. For this reason, the following code is a symptom of ....Read More
Items of ParamArray can be Missing
Total Hit (2707) When using the ParamArray keyword within a procedure, always remember that when the procedure is invoked from elsewhere in the program one of the argument might be omitted, and you should keep this into account. Here is an example of a routine that uses ParamArray: «Code LangId=1» Function Max( ....Read More
LenB has changed from VB5 to VB6
Total Hit (3325) Visual Basic stores UDTs in unpacked format, that is it alignes all UDT elements to the double word (except that Integers and Boolean are aligned to the word, and byte elements aren't aligned at all). To keep the elements aligned VB adds padding bytes where necessary. For instance the structure: « ....Read More
Manufacture a Missing value
Total Hit (3093) 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
Missing Option Explicit directives
Total Hit (2578) The single statement that is most useful to avoid bugs is Option Explicit. Always use it in every module of your applications. Even better, let the Visual Basic IDE automatically add one whenever you create a new module to your project. You can do it by selecting the "Require Variable Declarations" ....Read More
Never use the End statement
Total Hit (2880) There are a lot of risks involved in using End in VB programs: your databases might not be correctly closed, your objects are not correctly terminated, etc. You should always terminate a program by unloading all the forms. You can do this using the following routine: «Code LangId=1» For index = F ....Read More
Persistent breakpoints
Total Hit (2685) When you close a VB IDE session, VB saves the code but doesn't save the current set of breakpoints. If you need (non-conditional) breakpoints to persist among sessions, don't use the F9 key. Instead, use the following statement «Code LangId=1» Debug.Assert False «/Code» The above code will alwa ....Read More
Property Procedures in BAS modules
Total Hit (2742) Visual Basic supports Property procedures to implement properties in your own CLS and FRM modules. However, it turns out that you can use Property procedures even within BAS code modules. How can this improve your programming skills? In many a way, as I will demonstrate. Say your program include ....Read More
Quick comparison among UDTs
Total Hit (3465) When you need to compare two User Defined Type (UDT) variables to check whether they are equal, the only approach that you can follow in plain VB is to compare each individual element of the UDT. For example, say that you have the following Type declaration: «Code LangId=1» Private Type MyUDT ....Read More
Reduce the number of DoEvents
Total Hit (3735) Don't fill your code with unnecessary DoEvents statements, especially within time-critical loops. If you can't avoid that, at least you can reduce the overhead by invoking DoEvents only every N iterations of the loop, using a statement like this: «Code LangId=1» If (loopNdx Mod 10) = 0 Then DoEv ....Read More
REMark out a group of lines
Total Hit (3441) VB5 and VB6 environments include a pair hidden commands that let you remark and unremark a group of statements. These commands are hidden in the sense that they can be found on the secondary Edit toolbar that isn't displayed by default. To make these commands available, right-click anywhere on the m ....Read More
Remove collection items from the beginning
Total Hit (2618) There are many different ways to delete all the items in a collection, but some of them are much faster than the others. Let's start with a collection that holds 10,000 items: «Code LangId=1» Dim col As New Collection, i As Long For i = 1 To 10000 col.Add i, CStr(i) Next «/Code» You can d ....Read More
Short-circuit evaluation with Select Case
Total Hit (2945) Short-circuit evaluation is an optimization technique automatically adopted by most modern compilers, including all flavors of C++, Borland Delphi and many others. Unfortunately, the Visual Basic compiler is not in this group. This optimization cuts down the time needed to evaluate a boolean express ....Read More
Simplify and optimize expressions with And, Or and Xor operators
Total Hit (2561) Let's assume you must test whether the most significan bit of an integer value is set or not. This is the code that you usually write: ' two cases, depending on whether the value is Integer or Long If intValue And &H8000 Then ' most significant bit is set End If If lngValue And &H8000000 ....Read More
Simplify your code with Inc and Dec functions
Total Hit (2814) Unlike other languages - such as C and Delphi - VB lacks of the capability to increment and decrement a variable. Adding this feature, in the form of reusable Function routines, is simple: «Code LangId=1» Function Inc(Value As Variant, Optional Increment As Variant = 1) As Variant Value = V ....Read More

(Page 1 of 2) 52 Result(s) found  1 2

Recommanded Links


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  BlogsZappySys

© 2008 BinaryWorld LLC. All rights reserved.