交换

来源:互联网 发布:代驾管理系统源码 编辑:程序博客网 时间:2024/04/28 18:38

打开vb

 

方法一:

Private Sub Command3_Click()

Dim a As String
a = Text1.Text
Text1.Text = Text2.Text
Text2.Text = a

End Sub

Private Sub Text1_Change()
Text1.BackColor = vbBlack
Text1.ForeColor = vbRed
End Sub

Private Sub Text2_Change()
Text2.BackColor = vbBlack
Text2.ForeColor = vbWhite
End Sub


 

方法二:

Private Sub 变换_Click()
Dim a As String
a = Me.Label1.Caption
Me.Label1.Caption = Me.Label2.Caption
Me.Label2.Caption = a
Dim b As String
b = Me.Label1.ForeColor
Me.Label1.ForeColor = Me.Label2.ForeColor
Me.Label2.ForeColor = b

End Sub

0 0
原创粉丝点击