📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 6690
ClientLeft = 60
ClientTop = 345
ClientWidth = 7935
LinkTopic = "Form1"
ScaleHeight = 6690
ScaleWidth = 7935
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "<<"
Height = 375
Left = 3720
TabIndex = 3
Top = 2760
Width = 855
End
Begin VB.CommandButton Command1
Caption = ">>"
Height = 375
Left = 3720
TabIndex = 2
Top = 1320
Width = 855
End
Begin VB.ListBox List2
Height = 3630
Left = 4800
Style = 1 'Checkbox
TabIndex = 1
Top = 840
Width = 2655
End
Begin VB.ListBox List1
Height = 3630
Left = 720
Style = 1 'Checkbox
TabIndex = 0
Top = 840
Width = 2655
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim count1, count2 As Integer
Private Sub Command1_Click()
count1 = List1.ListCount
ReDim select1(count1) As String
ReDim id1(count1) As Integer
For i = 0 To count1 - 1
select1(i) = List1.List(i)
If List1.Selected(i) = True Then
id1(i) = 1
Else
id1(i) = 0
End If
Next
List1.Clear
For i = 0 To count1 - 1
If id1(i) = 0 Then
List1.AddItem select1(i)
Else
List2.AddItem select1(i)
End If
Next
If List2.ListCount > 0 Then
Command2.Enabled = True
End If
If List1.ListCount = 0 Then
Command1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Dim select2() As String
Dim id2() As Integer
count2 = List2.ListCount
For i = 0 To count2 - 1
ReDim Preserve id2(i)
ReDim Preserve select2(i)
select2(i) = List2.List(i)
If List2.Selected(i) = True Then
id2(i) = 1
Else
id2(i) = 0
End If
Next
List2.Clear
For i = 0 To count2 - 1
If id2(i) = 0 Then
List2.AddItem select2(i)
Else
List1.AddItem select2(i)
End If
Next
If List1.ListCount > 0 Then
Command1.Enabled = True
End If
If List2.ListCount = 0 Then
Command2.Enabled = False
End If
End Sub
Private Sub Form_Load()
Command2.Enabled = False
List1.AddItem "软件工程师"
List1.AddItem "硬件工程师"
List1.AddItem "程序员"
List1.AddItem "数据库管理员"
List1.AddItem "网络工程师"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -