home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form SWFrm
- BackColor = &H00C0C0C0&
- Caption = "Swapping"
- ClientHeight = 3000
- ClientLeft = 4200
- ClientTop = 2355
- ClientWidth = 3795
- Height = 3405
- Left = 4140
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- ScaleHeight = 3000
- ScaleWidth = 3795
- Top = 2010
- Width = 3915
- Begin CommandButton swCmd
- Caption = "Swap"
- Height = 375
- Left = 1425
- TabIndex = 3
- Top = 2370
- Width = 975
- End
- Begin TextBox Sws
- Height = 285
- Index = 2
- Left = 2025
- TabIndex = 6
- Text = "Second Str$"
- Top = 1740
- Width = 1215
- End
- Begin TextBox Sws
- Height = 285
- Index = 1
- Left = 480
- TabIndex = 5
- Text = "String One"
- Top = 1740
- Width = 1215
- End
- Begin TextBox SWV
- Height = 285
- Index = 2
- Left = 2040
- TabIndex = 2
- Text = "6789"
- Top = 675
- Width = 855
- End
- Begin TextBox SWV
- BackColor = &H00FFFFFF&
- Height = 285
- Index = 1
- Left = 825
- TabIndex = 1
- Text = "12345"
- Top = 675
- Width = 735
- End
- Begin Label Label2
- BackColor = &H00C0C0C0&
- Caption = " Swap Strings"
- Height = 210
- Left = 1290
- TabIndex = 4
- Top = 1455
- Width = 1230
- End
- Begin Label Label1
- BackColor = &H00C0C0C0&
- Caption = " Swap Values"
- Height = 210
- Left = 1260
- TabIndex = 0
- Top = 360
- Width = 1185
- End
- DefInt A-Z
- Sub Form_Paint ()
- EmbossFrm SWFrm, 465, 375, 1080, 3240, 1
- EmpressFrm SWFrm, 1575, 270, 2175, 3510, 1
- concaveFrm SWFrm, 4
- ConcaveCtl SWV(1), 3
- ConcaveCtl SWV(2), 3
- ConcaveCtl SWS(1), 3
- ConcaveCtl SWS(2), 3
- End Sub
- Sub swCmd_Click ()
- ' Message sent flag - don't wanna bug user
- MsgSent = 0
- 'make sure SwapValue 1 is INT
- a% = Int(Val(LTrim$(RTrim$(SWV(1).text))))
- ' compare to simple value in case there is a decimal
- If a% <> Val(LTrim$(RTrim$(SWV(1).text))) Then
- ' use WIN's MessageBox to note restrictions
- Msg$ = "We are only doing INTEGER Swaps here '[" + SWV(1).text + "].'"
- MsgBox Msg$, 64, "WGlib"
-
- ' Set flag so second test msg is not redundant
- MsgSent = 1
- End If
- ' same thing for second value
- b% = Int(Val(LTrim$(RTrim$(SWV(2).text))))
- If b% <> Val(LTrim$(RTrim$(SWV(2).text))) Then
- If MsgSent = 0 Then
- Msg$ = "We are only doing INTEGER Swaps here '[" + SWV(2).text + "].'"
- MsgBox Msg$, 64, "WGlib"
- End If
- End If
- ' swap values, restore to text box control
- SwapI a, b
- SWV(1).text = Format$(a)
- SWV(2).text = Format$(b)
- 'assign test to string vars
- i$ = SWS(1).text
- j$ = SWS(2).text
- ' swap and restore to .Text property
- SwapStr i$, j$
- SWS(1).text = i$
- SWS(2).text = j$
- End Sub
-