Hi
Thanks for replying so quickly - I've put your code in the fastest speed bit & altered it so that there are 3 records to be found but it's still not finding the fastest - it keep showing the first hd. For each hardrive I enter name hd1, hd2, hd3 then 4.8 for capacity for each, then 231, 231,233 for transfer rate. The entire code is below.
Private Sub cmdEnd_Click()
End
End Sub
Private Sub cmdRun_Click()
Dim transferspeed(0 To 2) As Single
Dim transferrate(0 To 2) As Long
Dim yname(0 To 2) As String
Dim capacity(0 To 2) As Single
Dim fastest As Variant
Call properties(yname(), transferrate(), capacity())
Call calculate(capacity(), transferrate(), transferspeed())
Call fastestdrive(transferspeed(), fastest)
Call displayspeed(capacity(), transferspeed(), transferrate(), yname(), fastest)
End Sub
Private Sub properties(ByRef yname() As String, transferrate() As Long, capacity() As Single)
Dim index As Integer
index = 0
For index = 0 To 2
yname(index) = InputBox("Please enter Hard Drive's name")
capacity(index) = InputBox("Please enter Hard Drive's capacity")
transferrate(index) = InputBox("Please enter Hard Drive's transfer rate")
Next index
End Sub
Private Sub calculate(ByRef capacity() As Single, transferrate() As Long, transferspeed() As Single)
Dim index As Integer
index = 0
For index = 0 To 2
transferspeed(index) = capacity(index) * 1024 * (8 / transferrate(index))
Next index
End Sub
Private Sub fastestdrive(ByRef transferspeed() As Single, ByVal fastest As Variant)
Dim index As Integer
Dim total1 As Integer
total1 = transferspeed(0)
For index = 0 To 2
If transferspeed(index) < total1 Then
fastest = index
total1 = transferspeed(index)
End If
Next index
End Sub
Private Sub displayspeed(ByRef capacity() As Single, transferspeed() As Single, transferrate() As Long, yname() As String, fastest As Variant)
picDisplay.Print "The fastest Hard Drive is:"; yname(fastest); ""
picDisplay.Print "The capacity of the fastest Hard Drive is "; capacity(fastest); "Gb"
picDisplay.Print "The transfer rate of the fastest Hard Drive is "; transferrate(fastest); "mbps"
picDisplay.Print "The transfer time of the fastest Hard Drive is "; transferspeed(fastest); "seconds"
picDisplay.Print
End Sub
thanks very much.
being mad really does rock!!!