写了你的第一个,用了arraylist,很方便的就计算出来了...
[CODE]Imports System.Collections
Public Class Form3
Inherits System.Windows.Forms.Form
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写 dispose 以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意: 以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents TextBox8 As System.Windows.Forms.TextBox
Friend WithEvents TextBox9 As System.Windows.Forms.TextBox
Friend WithEvents TextBox10 As System.Windows.Forms.TextBox
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents lbldf As System.Windows.Forms.Label
Friend WithEvents rtb As System.Windows.Forms.RichTextBox
Friend WithEvents Label4 As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.TextBox2 = New System.Windows.Forms.TextBox
Me.TextBox3 = New System.Windows.Forms.TextBox
Me.TextBox4 = New System.Windows.Forms.TextBox
Me.TextBox5 = New System.Windows.Forms.TextBox
Me.TextBox6 = New System.Windows.Forms.TextBox
Me.TextBox7 = New System.Windows.Forms.TextBox
Me.TextBox8 = New System.Windows.Forms.TextBox
Me.TextBox9 = New System.Windows.Forms.TextBox
Me.TextBox10 = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.Label2 = New System.Windows.Forms.Label
Me.lbldf = New System.Windows.Forms.Label
Me.rtb = New System.Windows.Forms.RichTextBox
Me.Label4 = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(37, 48)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(24, 21)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "7"
Me.TextBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(73, 48)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(24, 21)
Me.TextBox2.TabIndex = 0
Me.TextBox2.Text = "1"
Me.TextBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(109, 48)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(24, 21)
Me.TextBox3.TabIndex = 0
Me.TextBox3.Text = "4"
Me.TextBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(145, 48)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(24, 21)
Me.TextBox4.TabIndex = 0
Me.TextBox4.Text = "4"
Me.TextBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(181, 48)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(24, 21)
Me.TextBox5.TabIndex = 0
Me.TextBox5.Text = "10"
Me.TextBox5.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(217, 48)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(24, 21)
Me.TextBox6.TabIndex = 0
Me.TextBox6.Text = "3"
Me.TextBox6.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(253, 48)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(24, 21)
Me.TextBox7.TabIndex = 0
Me.TextBox7.Text = "9"
Me.TextBox7.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox8
'
Me.TextBox8.Location = New System.Drawing.Point(289, 48)
Me.TextBox8.Name = "TextBox8"
Me.TextBox8.Size = New System.Drawing.Size(24, 21)
Me.TextBox8.TabIndex = 0
Me.TextBox8.Text = "10"
Me.TextBox8.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox9
'
Me.TextBox9.Location = New System.Drawing.Point(325, 48)
Me.TextBox9.Name = "TextBox9"
Me.TextBox9.Size = New System.Drawing.Size(24, 21)
Me.TextBox9.TabIndex = 0
Me.TextBox9.Text = "6"
Me.TextBox9.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'TextBox10
'
Me.TextBox10.Location = New System.Drawing.Point(361, 48)
Me.TextBox10.Name = "TextBox10"
Me.TextBox10.Size = New System.Drawing.Size(24, 21)
Me.TextBox10.TabIndex = 0
Me.TextBox10.Text = "2"
Me.TextBox10.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label1.Location = New System.Drawing.Point(184, 24)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(29, 17)
Me.Label1.TabIndex = 1
Me.Label1.Text = "评分"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(152, 88)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(136, 32)
Me.Button1.TabIndex = 2
Me.Button1.Text = "开始评分"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label2.Location = New System.Drawing.Point(112, 139)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(60, 17)
Me.Label2.TabIndex = 3
Me.Label2.Text = "最终得分:"
'
'lbldf
'
Me.lbldf.AutoSize = True
Me.lbldf.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.lbldf.ForeColor = System.Drawing.Color.Red
Me.lbldf.Location = New System.Drawing.Point(192, 136)
Me.lbldf.Name = "lbldf"
Me.lbldf.Size = New System.Drawing.Size(0, 22)
Me.lbldf.TabIndex = 4
Me.lbldf.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'rtb
'
Me.rtb.Location = New System.Drawing.Point(24, 194)
Me.rtb.Name = "rtb"
Me.rtb.Size = New System.Drawing.Size(368, 118)
Me.rtb.TabIndex = 5
Me.rtb.Text = ""
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("宋体", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(134, Byte))
Me.Label4.Location = New System.Drawing.Point(168, 170)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(54, 17)
Me.Label4.TabIndex = 6
Me.Label4.Text = "评分过程"
'
'Form3
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(424, 342)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.rtb)
Me.Controls.Add(Me.lbldf)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.TextBox8)
Me.Controls.Add(Me.TextBox9)
Me.Controls.Add(Me.TextBox10)
Me.Name = "Form3"
Me.Text = "Form3"
Me.ResumeLayout(False)
End Sub
#End Region
Public Fengshu As ArrayList
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Fengshu = New ArrayList
Dim i As Integer = 1
rtb.Text = "开始循环读取所有分数,并加入数组中" & Chr(13)
Fengshu.Add(CInt(TextBox1.Text()))
Fengshu.Add(CInt(TextBox2.Text()))
Fengshu.Add(CInt(TextBox3.Text()))
Fengshu.Add(CInt(TextBox4.Text()))
Fengshu.Add(CInt(TextBox5.Text()))
Fengshu.Add(CInt(TextBox6.Text()))
Fengshu.Add(CInt(TextBox7.Text()))
Fengshu.Add(CInt(TextBox8.Text()))
Fengshu.Add(CInt(TextBox9.Text()))
Fengshu.Add(CInt(TextBox10.Text()))
rtb.Text &= "成功插入" & Fengshu.Count & "个分数" & Chr(13)
rtb.Text &= "按大小进行排序..." & Chr(13)
Fengshu.Sort()
Dim fshu As Integer
rtb.Text &= "排序后的顺序为:" & Chr(13)
i = 1
For Each fshu In Fengshu
rtb.Text &= "第" & i & "个分数为:" & fshu.ToString & Chr(13)
i += 1
Next
rtb.Text &= "去掉最高分:" & Fengshu(0) & Chr(13)
rtb.Text &= "去掉最低分:" & Fengshu(9) & Chr(13)
Fengshu.RemoveAt(0)
Fengshu.RemoveAt(8)
rtb.Text &= "剩余的分数为:"
For Each fshu In Fengshu
rtb.Text &= fshu & ","
Next
rtb.Text &= Chr(13)
Dim zongfengshu As Integer
For Each fshu In Fengshu
zongfengshu += fshu
Next
rtb.Text &= "剩余8个分数的总和为:" & zongfengshu.ToString
rtb.Text &= "所以最后得分为:" & (zongfengshu / 8).ToString
lbldf.Text = (zongfengshu / 8)
End Sub
End Class[/CODE]