devxlogo

Remember SWAP?

Remember SWAP?

I was surprised to learn that the SWAP command was not implementedin Visual Basic when I read a letter in the February 1996 issueof VBPJ requesting that Microsoft bring to Visual Basicthe 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 workwith other data types.

Here is an example:

 Option ExplicitPrivate 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
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist