dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


Tip of the Day
Language: Visual Basic
Expertise: Beginner
Aug 6, 1997

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


Remember SWAP?

I was surprised to learn that the SWAP command was not implemented in Visual Basic when I read a letter in the February 1996 issue of VBPJ requesting that Microsoft bring to Visual Basic the Qbasic Command SWAP.

In a routine I use to sort a file, this code performs the swap. I use character strings for this example, but the logic will work with other data types.

Here is an example:

 
Option Explicit

Private Sub Form_Load()
        Dim a, b, c As String * 4
        a = "AaAa"
        b = "BbBb"
        Debug.Print a; Spc(5); b 
        'Before the swap
        c = a
        a = b
        b = c
        Debug.Print a; Spc(5); b 
        'After the swap.
End Sub



David Ferber
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date