将以下内容复制到记事本 另存为my.frm文件 后打开即可
VERSION 5.00
Begin VB.Form Form1
Caption = "R"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "Z"
Height = 180
Index = 25
Left = 3600
TabIndex = 26
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "Y"
Height = 180
Index = 24
Left = 3000
TabIndex = 25
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "X"
Height = 180
Index = 23
Left = 2520
TabIndex = 24
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "W"
Height = 180
Index = 22
Left = 2040
TabIndex = 23
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "V"
Height = 180
Index = 21
Left = 1560
TabIndex = 22
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "U"
Height = 180
Index = 20
Left = 1080
TabIndex = 21
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "T"
Height = 180
Index = 19
Left = 600
TabIndex = 20
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "S"
Height = 180
Index = 18
Left = 120
TabIndex = 19
Top = 1440
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "R"
Height = 180
Index = 17
Left = 4080
TabIndex = 18
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "Q"
Height = 180
Index = 16
Left = 3600
TabIndex = 17
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "P"
Height = 180
Index = 15
Left = 3000
TabIndex = 16
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "O"
Height = 180
Index = 14
Left = 2520
TabIndex = 15
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "N"
Height = 180
Index = 13
Left = 2040
TabIndex = 14
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "M"
Height = 180
Index = 12
Left = 1560
TabIndex = 13
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "L"
Height = 180
Index = 11
Left = 1080
TabIndex = 12
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "K"
Height = 180
Index = 10
Left = 600
TabIndex = 11
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "J"
Height = 180
Index = 9
Left = 120
TabIndex = 10
Top = 1080
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "I"
Height = 180
Index = 8
Left = 4080
TabIndex = 9
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "H"
Height = 180
Index = 7
Left = 3600
TabIndex = 8
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "G"
Height = 180
Index = 6
Left = 3000
TabIndex = 7
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "F"
Height = 180
Index = 5
Left = 2520
TabIndex = 6
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "E"
Height = 180
Index = 4
Left = 2040
TabIndex = 5
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "D"
Height = 180
Index = 3
Left = 1560
TabIndex = 4
Top = 720
Width = 375
End
Begin VB.TextBox Text1
Height = 270
Left = 1680
TabIndex = 3
Top = 2040
Width = 1215
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "C"
Height = 180
Index = 2
Left = 1080
TabIndex = 2
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "B"
Height = 180
Index = 1
Left = 600
TabIndex = 1
Top = 720
Width = 375
End
Begin VB.CheckBox Check1
Alignment = 1 'Right Justify
Caption = "A"
Height = 180
Index = 0
Left = 120
TabIndex = 0
Top = 720
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Check1_Click(Index As Integer)
Dim sum As Integer
Dim i As Integer
sum = 0
For i = 0 To 25
If Check1.Item(i).Value = 1 Then
sum = sum + Check1.Item(i).Index + 1
End If
Next
Text1.Text = sum
End Sub
这似乎过于简单 将以下内容复制到记事本 另存为1.frm文件 后打开即可
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4935
ClientLeft = 60
ClientTop = 450
ClientWidth = 4260
LinkTopic = "Form1"
ScaleHeight = 4935
ScaleWidth = 4260
StartUpPosition = 3 '窗口缺省
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 23
Left = 1560
TabIndex = 24
Top = 4440
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 22
Left = 1560
TabIndex = 23
Top = 4200
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 21
Left = 1560
TabIndex = 22
Top = 3840
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 20
Left = 1680
TabIndex = 21
Top = 3480
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 19
Left = 1560
TabIndex = 20
Top = 3120
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 18
Left = 1560
TabIndex = 19
Top = 2760
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 17
Left = 1560
TabIndex = 18
Top = 2400
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 16
Left = 1560
TabIndex = 17
Top = 2040
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 15
Left = 1680
TabIndex = 16
Top = 1680
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 14
Left = 1560
TabIndex = 15
Top = 1200
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 13
Left = 1680
TabIndex = 14
Top = 840
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 12
Left = 1680
TabIndex = 13
Top = 480
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 11
Left = 1680
TabIndex = 12
Top = 120
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 10
Left = 360
TabIndex = 11
Top = 4200
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 9
Left = 360
TabIndex = 10
Top = 3840
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 8
Left = 360
TabIndex = 9
Top = 3480
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 7
Left = 360
TabIndex = 8
Top = 3120
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 6
Left = 360
TabIndex = 7
Top = 2760
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 5
Left = 360
TabIndex = 6
Top = 2280
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 4
Left = 360
TabIndex = 5
Top = 1920
Width = 1215
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 495
Index = 3
Left = 240
TabIndex = 4
Top = 1440
Width = 1335
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 495
Index = 2
Left = 360
TabIndex = 3
Top = 960
Width = 1335
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 375
Left = 3240
TabIndex = 2
Top = 1320
Width = 855
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 495
Index = 1
Left = 360
TabIndex = 1
Top = 480
Width = 1335
End
Begin VB.CheckBox Check
Caption = "Check1"
Height = 375
Index = 0
Left = 360
TabIndex = 0
Top = 120
Width = 1215
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim Sum As Single
For i = 0 To 23
If Check(i).Value = 1 Then
Sum = Sum + Asc(Check(i).Caption) - 64
End If
Next
MsgBox Sum
End Sub
Private Sub Form_Load()
For i = 0 To 23
Check(i).Caption = Chr(65 + i)
Next
End Sub
先设置4个变量
初始都为0
对应4个复选框
都复选框被选上后由0变为对应的值
计算的时候4个值全加就可以了
PS:0分的提问只给思路不给代码