User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Visual Basic 4 / 5 / 6 section within the Software Development category of DaniWeb, a massive community of 402,631 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,211 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Aug 6th, 2006
Views: 7,972
Swaps Two Elements Of An Array (So that say, indice1's value would become indice2's value, and vice versa). Simple Code Piece Really...
visualbasic Syntax | 4 stars
  1. Public Sub Swap(ByRef AName() As String, Indice1 As Integer, Indice2 As Integer)
  2. Dim tmp As String
  3.  
  4. ' /* Set The Temporary Variable To The Value Of The First Passed Indice */
  5. tmp = AName(Indice1)
  6.  
  7. ' /* Replace The Value Of The First Passed Indice, With The Value Of The Second */
  8. AName(Indice1) = AName(Indice2)
  9.  
  10. ' /* Set The Value Of The Second Passed Indice, To The Value Of The First Passed Indice */
  11. AName(Indice2) = tmp
  12.  
  13. End Sub
Post Comment

Only community members can submit or comment on code snippets. You must register or log in to contribute.

DaniWeb Marketplace (Sponsored Links)
All times are GMT -4. The time now is 1:56 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC