Hi all, I'm doing this Visual Basic prog for my coursework task, but I'm crap at VB. It has to take the size of a directory and the names & transfer speeds of 5 hard disks, and calculate then print each speed. It then has to print the fastest HD out again below using the same headings.
Option Explicit
Option Base 1
------------------------------------------------------------
Private Sub cmdCalc_Click()
Dim loops As Integer
Dim rate(5) As Integer
Dim drive(5) As String
Dim min, max As Integer
Dim dir As Long
Dim fast As Integer
Dim element As Integer
Dim time As Long
dir = InputBox("Please enter the size of the Directory being transferred")
drive(loops) = get_alpha("Name")
For loops = 1 To 5
rate(loops) = get_alpha(100, 10000, "Transfer rate")
time(loops) = 0 'Put time calc here
picDisplay.Print Tab(15); "Name of HD"; Tab(40); "Transfer Rate";
Tab(65); "Directory Size"; Tab(90); "Transfer time"
picDisplay.Print Tab(15); drive(loops); Tab(40); rate(loops);
Tab(65); dir(loops); Tab(90); time(loops)
Next
element = get_max(fast())
picDisplay.Print "The fastest hard disk is " & element
End Sub
------------------------------------------------------------------------------
Public Function get_alpha(ByVal low, ByVal high) As Integer
get_alpha = InputBox("enter the " & note)
While get_alpha < low Or get_alpha > high
get_alpha = InputBox("out of range, re-enter")
Wend
End Function
-----------------------------------------------------------------------------
Public Function get_max(fast) As Integer
Dim fastest As Integer
Dim loops As Integer
fastest = fast(1)
get_max = 1
For loops = 2 To 5
If fast(loops) > fastest Then
fastest = fast(loops)
get_max = loops
End If
Next
End Function
-------------------------------------------------------------------------
Private Sub cmdEnd_Click()
Dim leave As Integer
leave = MsgBox("Are you sure you want to exit?", 36, "Exit?")
If leave = 6 Then
End
End If
End Sub
Any help would be appreciated