Need help about elevator sumulation for vb 6

Recommended Answers

All 9 Replies

And...?

Is this a homework project? If so, what are the specs? what have you done so far? What do you need help with?

ive finish almost everything but im having a problem in fixing the timer.. because every image just jump to the floor that I specify not like an elevator that passes thru each floor

yes its a homework project... the project is to make an elevator simulation with 15 floors, ive finish this so far

Private Sub cmddown_Click()
          a = 2
          For x = a To txt1
          Call Timer2_Timer
Next
End Sub
 
Private Sub cmdup_Click()
          a = 2
          For x = a To txt1
          Call Timer1_Timer
Next
End Sub
 
Private Sub Form_Load()
          Timer1.Enabled = False
          Timer2.Enabled = False
End Sub
 
Private Sub Timer1_Timer()
          For x = 1 To 1
                    Image1.Top = Image1.Top - 360
          Next
End Sub
 
Private Sub Timer2_Timer()
          For x = 1 To 1
                    Image2.Top = Image2.Top + 360
          Next
End Sub

my problem is the elevator jumps to the floor i specify but I need it to pass thru every floor and stops to the floor i specify

Can you attach the project to a post, or e-mail it to me (in a .zip [e-mail is in my profile]) so that I can have the pictures and everything needed for this to run?

already solved the problem thank you to those who help me.....

For those of us (myself included) who have been tracking this thread.... what was the solution?

here is my solution, but still not perfect. hope this still helps!

Private Sub cmddown_Click()
x = InputBox("Enter Desired Floor", "Elevator Program", "1")
txt1 = x
If (x >= 1) Or (x <= 15) Then
Timer2.Enabled = True
Else
y = MsgBox("Floor not available", 48, "Warning")
End If
End Sub

Private Sub cmdemr_Click()
Timer1.Enabled = False
Timer2.Enabled = False
End Sub

Private Sub cmdexit_Click()
End
End Sub

Private Sub cmdup_Click()
x = InputBox("Enter Desired Floor", "Elevator Program", "1")
txt1 = x
If (x >= 1) Or (x <= 15) Then
Timer1.Enabled = True
Else
y = MsgBox("Floor not available", 48, "Warning")
End If
End Sub

Private Sub Form_Load()
Timer1.Enabled = False
Timer2.Enabled = False
End Sub

Private Sub Timer1_Timer()
Image1.Top = Image1.Top - 180
End Sub

Private Sub Timer2_Timer()
Image1.Top = Image1.Top + 180
End Sub

Private Sub Timer3_Timer()
x = txt1
Select Case x
    Case 1
        y = 5160
    Case 2
        y = 4800
    Case 3
        y = 4440
    Case 4
        y = 4080
    Case 5
        y = 3720
    Case 6
        y = 3360
    Case 7
        y = 3000
    Case 8
        y = 2640
    Case 9
        y = 2280
    Case 10
        y = 1920
    Case 11
        y = 1560
    Case 12
        y = 1200
    Case 13
        y = 840
    Case 14
        y = 480
    Case 15
        y = 120
End Select


If Image1.Top = y Then
    Timer1.Enabled = False
    Timer2.Enabled = False
End If
End Sub

Hey I want to do the same thing but using buttons to select floors I have a windows with just label that says the level that the elevator is going and I want to use a panel to select each level with buttons but I just have managed to make that each level change color but just go up from level one to ten I dont know if someone is getting the idea :S my skype is [SNIPPED] the only thing I know for sure is that I have to use timer

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.