Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

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

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

 

Check whether a string array contains an item (without a loop)
Total Hit (2557) To determine whether a String array contains a given item it seems that you can't avoid writing a loop. However, you can do it with just one line of code, using the new VB6 Join function: «Code LangId=1» ' ARR is an array of string, SEARCH is the value to be searched Found = InStr(1, vbNullChar ....Read More
Rating
Count Sort, a special case of indexed sort
Total Hit (2865) CountSort is yet another sort algorithm, which can be applied only under very particular conditions but that, when such conditions are met, turns to be the fastest of the lot. Count Sort can be used when the key is of Integer type, or when it is of Long type but the range of values is not too large. ....Read More
Rating
Polymorphic array procedures
Total Hit (2262) You can create "polymorphic" routines that work with any type of array (except arrays of fixed-length strings, or UDTs) by using Variant parameters. Take for example the following code: «Code LangId=1» Function Sum(arr As Variant) As Variant Dim i As Long For i = LBound(arr) To UBound( ....Read More
Rating
Quickly clear a portion of an array
Total Hit (2784) The fastest way to clear an array is to ReDim (if the array is dynamic) or Erase it (if the array is Static). However, if you want to clear a portion of an array, it seems that you must code a For-Next loop. If you are dealing with numeric arrays, there is a faster alternative, based on the ZeroM ....Read More
Rating
Quickly initialize Variant and String arrays
Total Hit (3389) Visual Basic doesn't provide any way to declare an array and initialize its elements at the same time. In most cases you end up with setting individual elements one by one, as in: «Code LangId=1» Dim strArray(0 To 3) As String strArray(0) = "Spring" strArray(1) = "Summer" strArray(2) = "Fall" ....Read More
Rating
Scan all the items in a multi-dimensional array with only one loop
Total Hit (2397) It seems that you need two nested For loops to iterate over all the elements of a 2-dimensional array, and three loops for a 3-dimensional array, and so on. However, the For Each loop offers you a neat and concise solution, as this code proves: «Code LangId=1» ' a 2-dimensional array of Strings ....Read More
Rating
Simple variables are always faster than array elements
Total Hit (2682) Reading and writing an item of an array is always slower than accessing a simple variable. Therefore, if you need to repeatedly use the same array item in a loop, you should assign it to a temporary variable and use that variable instead. I've included an example of this technique that scans an Inte ....Read More
Rating
Sorting on multiple keys
Total Hit (2270) Frequently you need to sort arrays of records using multiple keys. This may be required since one single key does not uniquely identify a record (e.g. you may need both LastName and FirstName to select a given employee in a large company where people with same name work), or it may be necessary for ....Read More
Rating
Speed up searches with hash tables
Total Hit (2959) You probably know that there are basically two methods to search a value in an array: the brute force approach (i.e. linear searching) and the binary search. Both of them have disadvantages: when the array counts N items, linear searching requires N/2 comparisons on the average for successful search ....Read More
Rating
The number of dimensions of an array
Total Hit (4022) Using "pure" VB, the only way to build a generic routine that returns the number of dimensions of an array passed as an argument is using a loop that repeatedly tests the LBound (o UBound) function until it fails: «Code LangId=1» Function ArrayDims(arr As Variant) As Integer Dim i As Intege ....Read More
Rating
Undocumented trick to speed up functions that return array
Total Hit (2604) VB6 functions can return an array. Unlike regular functions that return scalar values or objects, however, you can't use the name of the function as a local variable where to store intermediate result, and you are forced to work with a temporary local array, and then assign this array to the Functio ....Read More
Rating
ArrayAny - Return an initialized array of any type
Total Hit (2039) «Code LangId=1» ' Returns an array and initializes it with passed data. ' ' It is similar to the Array function, but it works with ' array of any type. The type of the returned array is ' assumed to be the type of the first element in the ' parameter list, so you might need to force a given ....Read More
Rating
ArrayAvg - The average of an array of any type
Total Hit (2082) «Code LangId=1» ' The average of an array of any type ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectively ' if IGNOREEMPTY argument is True or omitted, ' Empty values aren't accounted for Function ArrayA ....Read More
Rating
ArrayMax - The value and index of highest element in an array of any type
Total Hit (2080) «Code LangId=1»' Return the maximum value in an array of any type ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectively ' If MAXINDEX is passed, it receives the index of the ' maximum element in the array F ....Read More
Rating
ArrayMin - The value and index of lowest element in an array of any type
Total Hit (2140) «Code LangId=1» ' Return the minimum value in an array of any type ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectively ' If MININDEX is passed, it receives the index of the ' minimum element in the array ....Read More
Rating
ArrayShuffle - Randomize the order of elements in an array
Total Hit (3428) «Code LangId=1» ' Shuffle the elements of an array of any type ' (it doesn't work with arrays of objects or UDT) Sub ArrayShuffle(arr As Variant) Dim index As Long Dim newIndex As Long Dim firstIndex As Long Dim itemCount As Long Dim tmpValue As Variant firs ....Read More
Rating
ArrayStdDev - The standard deviation of a numeric array
Total Hit (3151) «Code LangId=1»' The standard deviation of an array of any type ' ' if the second argument is True or omitted, ' it evaluates the standard deviation of a sample, ' if it is False it evaluates the standard deviation of a population ' ' if the third argument is True or omitted, Empty values are ....Read More
Rating
ArraySum - The sum of all the items in an array of any type
Total Hit (2417) «Code LangId=1» ' Return the sum of the values in an array of any type ' (for string arrays, it concatenates all its elements) ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectively Function ArraySum(arr As ....Read More
Rating
ArrLongestItem - The value and index of the longest element of an array of any type
Total Hit (2301) «Code LangId=1»' The longest item in an array of any type ' (it applies the LEN function to all the items in the array ' and then takes the highest value) ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectively ....Read More
Rating
ArrShortestItem - The value and index of the shortest element of an array of any type
Total Hit (2164) «Code LangId=1»' The shortest item in an array of any type ' (it applies the LEN function to all the items in the array ' and then takes the highest value) ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectivel ....Read More
Rating
ArrShortestItem - The value and index of the shortest element of an array of any type
Total Hit (2102) «Code LangId=1»' The shortest item in an array of any type ' (it applies the LEN function to all the items in the array ' and then takes the highest value) ' ' FIRST and LAST indicate which portion of the array ' should be considered; they default to the first ' and last element, respectivel ....Read More
Rating
BubbleSort - Sort Arrays using the BubbleSort Algorithm
Total Hit (3022) «Code LangId=1» ' Bubble Sort an array of any type ' BubbleSort is especially convenient with small arrays (1,000 ' items or fewer) or with arrays that are already almost sorted ' ' NUMELS is the index of the last item to be sorted, and is ' useful if the array is only partially filled. ' ' ....Read More
Rating
CBitArray - a class for dealing with large arrays of Boolean
Total Hit (2299) «Code LangId=1» ' ------------------------------------------------------------------------ ' The CBITARRAY class ' ' simiulates an array of Boolean values ' saves memory by packing one element in one bit ' ' IMPORTANT: you make make ITEM the default member for this class ' do ....Read More
Rating
CombSort - A very efficient algorithm
Total Hit (2229) «Code LangId=1»' Comb Sort an array of any type ' ' CombSort is faster than all but QuickSort and close to it. ' On the other hand, the code is much simpler than QuickSort ' and can be easily customized for any array type ' This routine is based on an article appeared on the Byte ' magazine i ....Read More
Rating
Filter - A replacement for VB6's Filter function under VB5
Total Hit (2112) «Code LangId=1»' A replace for the Filter function under VB4 and VB5 ' ' Note that the source array is modified. For this reason ' this is declared as a Sub rather than a Function Sub Filter(arr() As String, ByVal Search As String, Optional ByVal Include As _ Boolean, Optional ByVal Comp ....Read More
Rating
FilterDuplicates - Delete duplicate items in an array
Total Hit (2148) «Code LangId=1» ' Filter out duplicate values in an array and compact ' the array by moving items to "fill the gaps". ' Returns the number of duplicate values ' ' it works with arrays of any type, except objects ' ' The array is not REDIMed, but you can do it easily using ' the following co ....Read More
Rating
GetArrayInfo - Retreive number of dimensions and the SAFEARRAY memory structure
Total Hit (3607) «Code LangId=1» Type SAFEARRAYBOUND cElements As Long ' # of elements in the array dimension lLbound As Long ' lower bounds of the array dimension End Type Type SAFEARRAY cDims As Integer ' Count of dimensions in this array. fFeatures As Integer ....Read More
Rating
TransposeMatrix - Rotate a bi-dimensional array
Total Hit (2246) «Code LangId=1» ' evaluate the transposed matrix ' ' a transposed matrix is the array you get when ' you "rotate" a bi-dimensional array Function TransposeMatrix(arr() As Double) As Double() Dim startRow As Long, startCol As Long Dim endRow As Long, endCol As Long Dim r As Lon ....Read More
Rating
HasDuplicateValues - Check if an array has duplicate values
Total Hit (2499) «Code LangId=1»' Returns True if an array contains duplicate values ' it works with arrays of any type Function HasDuplicateValues(arr As Variant) As Boolean Dim col As Collection, index As Long Set col = New Collection ' assume that the array contains duplicates HasDu ....Read More
Rating
ListBoxEnsureVisible - Ensure that a ListBox element is visible
Total Hit (2187) «Code LangId=1»' ensure that a listbox item is visible ' if the second argument is omitted, the index of current item is used ' ' NOTE: uses the ListBoxVisibleItems function Sub ListBoxEnsureVisible(lst As ListBox, Optional ByVal itemIndex As Long = -1) Dim visibleCount As Long ....Read More
Rating


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

Recommanded Links

 

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

© 2008 BinaryWorld LLC. All rights reserved.