Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

 
 
Thread Tools Display Modes
Prev Previous Post in Thread   Next Post in Thread Next
Old Dec 5th, 2005, 4:46 PM   #1
haddow64
Newbie
 
Join Date: Dec 2005
Posts: 4
Rep Power: 0 haddow64 is on a distinguished road
Help with prog

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
haddow64 is offline   Reply With Quote
 

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 8:56 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC