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 3 of 133) 3985 Result(s) found 


Add a file to the list of recent documents
Total Hit (2255) To add a file to the "Recents" folder, you just need a single API function: SHAddToRecentDocs. This function takes two parameters. The first is SHARD_PATH if you want to refer to the file with its path string, while is SHARD_PIDL if you use its identifier. The second is the path string of the file, ....Read More
Checking if a Floppy Drive is ready using FileSystemObject library
Total Hit (2519) The Microsoft Scripting Runtime Library offers a FileSystemObject and a Drive object that allow you to check if a Floppy drive is ready. Before writing the code you have to add this library to your project using the References dialog window. If the library isn't contained in the list, you can downlo ....Read More
Copy a directory tree
Total Hit (2352) Creating a VB routine that copies a whole directory tree can be a time-consuming job, but fortunately you don't have to do it. In fact, you can quickly create an entire folder, including all its subfolders, using the CopyFolder method of the FileSystemObject object, that is exposed by the Microsoft ....Read More
Counting characters in a file
Total Hit (3080) Ever needed to count how many characters of a given type are in a file? For instance, how many alphabetical characters, or digits, or spaces? You might read each line of the file using Line Input, but you will probably to load the whole file in memory using one single operation: «Code LangId=1» ....Read More
An enhanced VB DatePart function
Total Hit (3645) Here is an enhanced version of VB DatePart function: the first parameter is now an enumerated type, so easier to use. DatePartEx is 4-5 times faster than DatePart and supports also two new intervals: MonthName and WeekdayName.
Benchmarks with millisecond accuracy
Total Hit (2935) The Timer function returns a value which is only accurate to about 55 milliseconds, therefore it is not very useful for doing accurate benchmarks. If you need a better resolution you may try out this function:
Beware of slashes when formatting dates
Total Hit (2287) You probably use the Format function to format date, for example: «Code LangId=1» ? Format(Now, "mm/dd/yyyy") ' => 08/01/2001 ? Format(Now, "mm+dd+yyyy") ' => 08+01+2001 «/Code» It seems that this is everything you need to know, right? However, the story is quite different ....Read More
Create a system timer using AddressOf and a callback function
Total Hit (3180) The Timer control is great when you want to periodically execute a piece of code while the program is doing something else. However, it also has a couple of shortcomings: (1) it requires a parent form, so you can't use it directly inside a BAS module, and (2) it's Interval property can't be higher t ....Read More
Evaluate the number of days remaining in the current year
Total Hit (2231) The DatePart() function can return the number of days from the beginning of the current year, but there is no VB built-in function that returns the number of days left to the end of the year. You can work around this with the DateDiff function: «Code LangId=1» ' aDate contains a valid date Days ....Read More
High-precision timing with the QueryPerformanceCounter API function
Total Hit (3438) While VB Timer functions is sufficiently precise for most tasks, it doesn't provide the highest possible resolution most modern computer can provide. If your hardware supports high-resolution counters, you can do a much better job with a pair of API functions: «Code LangId=1» Private Type LARGE_ ....Read More
Retrieve Time Zone information
Total Hit (6082) The GetTimeZoneInformation API returns a TIME_ZONE_INFORMATION variable that contains several pieces of information about system's time date and time setting. The first Long value in this structure holds the "distance" (in minutes) from Greenwich standard time, so it's quite easy to create a GetTime ....Read More
Test for Leap Year
Total Hit (2611) As long as you trust VB's IsDate function (and you can, trust me), here's the shorted and fastest method to check if a year is a leap year or not: «Code LangId=1» Function IsLeapYear(year As Integer) As Boolean IsLeapYear = IsDate("2/29/" & CStr(year)) End Function «/Code» Here's is anot ....Read More
The age of a person
Total Hit (2181) You can quickly evaluate the age of a person using the following function: «Code LangId=1» Function Age(BirthDate As Date, Optional CurrentDate As Variant) As Integer If IsMissing(CurrentDate) Then CurrentDate = Now Age = Year(CurrentDate) - Year(BirthDate) End Property «/Code» If ....Read More
The beginning or end of previous week
Total Hit (3061) For reporting, many times you need to figure out what date last week began and ended. Use the code below to figure that out:
The number of days in a month
Total Hit (3102) You need just one-line function to evaluate the number of days in a month (while taking leap years into account, of course). The trick is to use the DateDiff and DateSerial functions to calculate the difference between the first day of the current month and the first day of the subsequent month : ....Read More
Tricks with DateSerial
Total Hit (2399) The DateSerial function has an interesting feature: it doesn't raise errors when you pass it an invalid month or day number. Instead, it evaluates the date as if the arguments were valid. For example, DateSerial(2000, 1, 32) returns the Date value of February 1, 2000. This behavior can (and should) ....Read More
Use Sleep API to add pauses to your programs
Total Hit (3300) Don't use an empty For...Next loop to add pauses to your programs; instead, use the Sleep API function, that releases the CPU and lets other apps in the system effectively multitask: «Code LangId=1» Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long) ' pause for 5 seconds Sleep 5000 ....Read More
Check whether a string array contains an item (without a loop)
Total Hit (2090) 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
Count Sort, a special case of indexed sort
Total Hit (2270) 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
Polymorphic array procedures
Total Hit (1816) 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
Quickly clear a portion of an array
Total Hit (2189) 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
Quickly initialize Variant and String arrays
Total Hit (2853) 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
Scan all the items in a multi-dimensional array with only one loop
Total Hit (1921) 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
Simple variables are always faster than array elements
Total Hit (2202) 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
Sorting on multiple keys
Total Hit (1837) 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
Speed up searches with hash tables
Total Hit (2410) 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
The number of dimensions of an array
Total Hit (3565) 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
Undocumented trick to speed up functions that return array
Total Hit (2103) 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
Tricks with LCase and UCase
Total Hit (2192) There are a few tricks that you can do with LCase$ and UCase$ functions. I doubt you will be using this tip in all your applications, but here they are for when you'll need them. Say you wish to check that a string (or a portion of it) does NOT include any alphabetical characters: instead of set ....Read More
Two handy functions for Null handling
Total Hit (2434) You're probably aware that most VB functions don't work well with Null values, which is an issue when you're working with database columns that can accept Nulls. For example, the following statement: «Code LangId=1» Dim s as String s = rs.Fields("AnyField") «/Code» can raise error 94 "Invali ....Read More

(Page 3 of 133) 3985 Result(s) found  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 ...

Recommanded Links


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

© 2008 BinaryWorld LLC. All rights reserved.