⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 上传的包含两个文件
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   Caption         =   "   "
   ClientHeight    =   4275
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4680
   LinkTopic       =   "Form2"
   ScaleHeight     =   4275
   ScaleWidth      =   4680
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command2 
      Caption         =   "退出"
      Height          =   495
      Left            =   3000
      TabIndex        =   6
      Top             =   3360
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "选举结果"
      Height          =   495
      Left            =   480
      TabIndex        =   5
      Top             =   3360
      Width           =   855
   End
   Begin VB.ListBox List1 
      Height          =   1320
      Left            =   360
      TabIndex        =   3
      Top             =   1560
      Width           =   1095
   End
   Begin VB.ComboBox Combo1 
      Height          =   1260
      Left            =   2880
      Style           =   1  'Simple Combo
      TabIndex        =   2
      Top             =   1560
      Width           =   1095
   End
   Begin VB.Label Label3 
      Caption         =   "候选人"
      Height          =   255
      Left            =   2880
      TabIndex        =   4
      Top             =   960
      Width           =   735
   End
   Begin VB.Label Label2 
      Caption         =   "投票情况"
      Height          =   255
      Left            =   360
      TabIndex        =   1
      Top             =   960
      Width           =   975
   End
   Begin VB.Label Label1 
      Caption         =   "选举班长为:"
      Height          =   375
      Left            =   360
      TabIndex        =   0
      Top             =   240
      Width           =   3015
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Dim number(4) As Integer

Private Sub Combo1_click()
If Combo1.ListIndex <> -1 Then
number(Combo1.ListIndex) = number(Combo1.ListIndex) + 1
List1.List(Combo1.ListIndex) = Combo1.List(Combo1.ListIndex) + " " + Str(number(Combo1.ListIndex))
End If
End Sub

Private Sub Command1_Click()
Dim i, max, vote As Integer
max = 0
For i = 0 To List1.ListCount
  If number(i) > max Then
  max = number(i)
  vote = i
  End If
Next i
Label1.Caption = "选举班长为:" + Combo1.List(vote)
End Sub

Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
Dim i As Integer
Dim people(4) As String
people(0) = "王量": people(1) = "张琼"
people(2) = "李晓": people(3) = "冯竟"
For i = 0 To 3
number(i) = 0
Next i
For i = 0 To 3
Combo1.AddItem people(i)
List1.AddItem people(i) + " " + Str(number(i))
Next i
End Sub
Private Sub combo1_keypress(keyascii As Integer)
Dim i As Integer
If keyascii = 13 Then
  For i = 0 To 3
  If Combo1.Text = Combo1.List(i) Then
     number(i) = number(i) + 1
     List1.List(i) = Combo1.List(i) + " " + Str(number(i))
     Exit Sub
  End If
  Next i
  b = MsgBox("对不起,此人不是候选人!", 32, "提示信息")
  Combo1.Text = ""
  End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -