Comatose 0 Tallied Votes 252 Views Share

Swaps Two Elements Of An Array (So that say, indice1's value would become indice2's value, and vice versa). Simple Code Piece Really...

Public Sub Swap(ByRef AName() As String, Indice1 As Integer, Indice2 As Integer)
Dim tmp As String

' /* Set The Temporary Variable To The Value Of The First Passed Indice */
tmp = AName(Indice1)

' /* Replace The Value Of The First Passed Indice, With The Value Of The Second */
AName(Indice1) = AName(Indice2)

' /* Set The Value Of The Second Passed Indice, To The Value Of The First Passed Indice */
AName(Indice2) = tmp

End Sub
a.j. 0 Newbie Poster

wow...this looks preti simple

AbulHassan 0 Newbie Poster

right , it looks too easy but which library should we use.

vb5prgrmr 143 Posting Virtuoso

Abul, that code does not require a reference...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.