01 Mar 2010 @ 11:25 AM 

Sorting Data Using Arrays – Visual Basic 6

Sorting is an operation that you often perform on arrays. As you probably know, there are dozens of different sort algorithms, each one with its strengths and weaknesses. I found that the Shell Sort algorithm works well in most cases, and I’ve prepared a generic routine that sorts any one-dimensional array of a data type compatible with the Variant type, either in ascending or descending order:

Sub ShellSortAny(arr As Variant, numEls As Long, descending As Boolean)
Dim index As Long, index2 As Long, firstItem As Long
Dim distance As Long, value As Variant
‘ Exit if it is not an array.
If VarType(arr) < vbArray Then Exit Sub
firstItem = LBound(arr)
‘ Find the best value for distance.
Do
distance = distance * 3 + 1
Loop Until distance > numEls
‘ Sort the array.
Do
distance = distance \ 3
For index = distance + firstItem To numEls + firstItem – 1
value = arr(index)
index2 = index
Do While (arr(index2 – distance) > value) Xor descending
arr(index2) = arr(index2 – distance)
index2 = index2 – distance
If index2 – distance < firstItem Then Exit Do
Loop
arr(index2) = value
Next
Loop Until distance = 1
End Sub

Posted By: admin
Last Edit: 01 Mar 2010 @ 11:25 AM

EmailPermalinkComments (0)
Tags
 01 Mar 2010 @ 7:00 AM 

Visual Basic 6 (VB6) – Beginners Tutorial

Welcome to Free Visual Basic 6 (VB6) tutorial for beginners. This Visual Basic 6 (VB6) tutorial helps you to learn Visual Basic 6.0 (VB6) programming in your own. Assuming you all are beginners to visual basic, each and every lesson in this tutorial is explained step by step with examples and source code.

Visual basic is a high level programming language developed from the earlier DOS version called BASIC. Though, Visual Basic .NET is the latest technology introduced by Microsoftwith tons of new features including the .NET framework and educational institues, Universities and Software Development companies have migrated to VB .NET, Visual Basic 6 is still widely learned and taught.

Learning Visual Basic 6 is quite easier than other programming languages such as C++, C#, Java etc. This is because Visual Basic enables you to work in a graphical user interface where you can just drag and drop controls that you want to work with where you have to write bunches of code to create in C++ or C# or even in Java. If you are new to programming and want to start it in the smoothest and easiest way, then you should start it with Visual Basic.

This Visual Basic 6 tutorial is for anyone who wants to learn to program his or her computer with Visual Basic. More importantly, this tutorial is for anyone who’s flipped through other programming resources only to be discouraged by obtuse language, jargon-ridden prose, and stuffed-shirt attitudes. The Visual Basic 6 (VB6) beginner’s conversational style incorporates plain-English explanations along with short programming examples to lead the novice programmer by the hand through the techno jungle of computer programming.

Posted By: admin
Last Edit: 01 Mar 2010 @ 07:00 AM

EmailPermalinkComments (0)
Tags

 Last 50 Posts
 Back
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 33
  • Comments » 0
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight