Public Class Form1
Inherits System.Windows.Forms.Form
Dim Index As Object
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
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
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents lstMedian As System.Windows.Forms.ListBox
Friend WithEvents btnAdd As System.Windows.Forms.Button
Friend WithEvents btnDisplay As System.Windows.Forms.Button
Friend WithEvents btnClear As System.Windows.Forms.Button
Friend WithEvents btnExit As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.lstMedian = New System.Windows.Forms.ListBox()
Me.btnAdd = New System.Windows.Forms.Button()
Me.btnDisplay = New System.Windows.Forms.Button()
Me.btnClear = New System.Windows.Forms.Button()
Me.btnExit = New System.Windows.Forms.Button()
Me.SuspendLayout()
'
'lstMedian
'
Me.lstMedian.Location = New System.Drawing.Point(8, 8)
Me.lstMedian.Name = "lstMedian"
Me.lstMedian.Size = New System.Drawing.Size(224, 199)
Me.lstMedian.Sorted = True
Me.lstMedian.TabIndex = 0
'
'btnAdd
'
Me.btnAdd.Location = New System.Drawing.Point(8, 216)
Me.btnAdd.Name = "btnAdd"
Me.btnAdd.Size = New System.Drawing.Size(88, 48)
Me.btnAdd.TabIndex = 1
Me.btnAdd.Text = "Add Value"
'
'btnDisplay
'
Me.btnDisplay.Location = New System.Drawing.Point(144, 216)
Me.btnDisplay.Name = "btnDisplay"
Me.btnDisplay.Size = New System.Drawing.Size(88, 48)
Me.btnDisplay.TabIndex = 2
Me.btnDisplay.Text = "Display Median"
'
'btnClear
'
Me.btnClear.Location = New System.Drawing.Point(240, 8)
Me.btnClear.Name = "btnClear"
Me.btnClear.Size = New System.Drawing.Size(48, 80)
Me.btnClear.TabIndex = 3
Me.btnClear.Text = "Clear"
'
'btnExit
'
Me.btnExit.Location = New System.Drawing.Point(240, 128)
Me.btnExit.Name = "btnExit"
Me.btnExit.Size = New System.Drawing.Size(48, 80)
Me.btnExit.TabIndex = 4
Me.btnExit.Text = "Exit"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 271)
Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.btnExit, Me.btnClear, Me.btnDisplay, Me.btnAdd, Me.lstMedian})
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
lstMedian.Items.Clear()
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click
Dim add As Object
add = CInt(InputBox("Enter a value:", "Enter"))
lstMedian.Items.Add(add)
End Sub
Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
Dim median, first, last, find As Object
first = 1
last = lstMedian.Items.Count - 1
find = (first + last) / 2
MessageBox.Show(find)
End Sub
End Class
this is the code, it is what the final product may look like, but im not completely finished, due to my delay with the list box