Please support our Visual Basic 4 / 5 / 6 advertiser: Programming Forums
Views: 2052 | Replies: 8
![]() |
•
•
Join Date: May 2005
Location: United Kingdom
Posts: 11
Reputation:
Rep Power: 0
Solved Threads: 1
Well I haven't tried moving a frame from one form to another in VB but why not have it hide the frame on the one form and show it on the other.
Let me give an example:
Create 2 forms, call them frmOne and frmTwo respectively. On each form create a frame, call it frFirst or both forms. Last create a timer on the form you want it to be removed from, call it tmrUpdate.
Ok in frmOne:
In frmTwo:
Although this doesn't move the frame from one form to the other it emulates the feeling of doing it, adding all the controls on both frames and setting the values respectively in tmrUpdate
Let me give an example:
Create 2 forms, call them frmOne and frmTwo respectively. On each form create a frame, call it frFirst or both forms. Last create a timer on the form you want it to be removed from, call it tmrUpdate.
Ok in frmOne:
Sub Form_Load()
frmTwo.Show '' Loads up form two
frFirst.Visible = True '' Just make sure the frame is visible
tmrUpdate.Interval = 500 '' This is half a seconds
End Sub
Sub tmrUpdate()
if ( frmOne.frFirst.Visible = True ) Then
frmOne.frFirst.Visible = False '' Set the frame on form one invisible
frmTwo.frFirst.Visible = True '' Set the frame on form two visible
End If
tmrUpdate.Interval = 0 '' Just so it won't keep updating
End SubSub Form_Load() frFirst.Visible = False '' The frame needs to be invisible End Sub
Although this doesn't move the frame from one form to the other it emulates the feeling of doing it, adding all the controls on both frames and setting the values respectively in tmrUpdate
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
I'm not really sure what you mean by showing frames, or what kind of purpose this would serve.... it sounds to me like there will be 3 fames on 1 form. It will start off with showing frame1, 500ms later will show frame2 and hide frame1, then 500ms later, hide 2 and show frame3. At This point it should load a new form, right? Just to clarify, you are talking about the frame control, not frames of an image, right?
•
•
Join Date: Feb 2005
Posts: 8
Reputation:
Rep Power: 0
Solved Threads: 0
This is very kind of you but I haven't made myself clear - stress setting in from trying to make my program work!
I have 1 form on which there are three frames. Frame 1 must be visible for 500 msecs; frame 2 for 100 msecs and frame 3 for 50 msecs. As I understand VB, this should be possible with a timing sub procedure but while the subprocedure works for forms, I cannot make it work for the frames!
For example:
Sub WaitForMSecs(MSecsVar)
Dim Starttime As Single
Starttime = Timer
Do Until Timer >= Starttime + (MSecsVar / 1000)
Loop
End Sub
So with the code:
frmA.show
fraOne.visible = true
WaitForMSecs 500
fraOne.Visible = False
fraTwo.visible = True
WaitForMSecs 100
fraTwo.Vvisible - False
etc.etc does not work
Any ideas?
I have 1 form on which there are three frames. Frame 1 must be visible for 500 msecs; frame 2 for 100 msecs and frame 3 for 50 msecs. As I understand VB, this should be possible with a timing sub procedure but while the subprocedure works for forms, I cannot make it work for the frames!
For example:
Sub WaitForMSecs(MSecsVar)
Dim Starttime As Single
Starttime = Timer
Do Until Timer >= Starttime + (MSecsVar / 1000)
Loop
End Sub
So with the code:
frmA.show
fraOne.visible = true
WaitForMSecs 500
fraOne.Visible = False
fraTwo.visible = True
WaitForMSecs 100
fraTwo.Vvisible - False
etc.etc does not work
Any ideas?
•
•
•
•
Originally Posted by Auron
Well I haven't tried moving a frame from one form to another in VB but why not have it hide the frame on the one form and show it on the other.
Let me give an example:
Create 2 forms, call them frmOne and frmTwo respectively. On each form create a frame, call it frFirst or both forms. Last create a timer on the form you want it to be removed from, call it tmrUpdate.
Ok in frmOne:
In frmTwo:Sub Form_Load() frmTwo.Show '' Loads up form two frFirst.Visible = True '' Just make sure the frame is visible tmrUpdate.Interval = 500 '' This is half a seconds End Sub Sub tmrUpdate() if ( frmOne.frFirst.Visible = True ) Then frmOne.frFirst.Visible = False '' Set the frame on form one invisible frmTwo.frFirst.Visible = True '' Set the frame on form two visible End If tmrUpdate.Interval = 0 '' Just so it won't keep updating End Sub
Sub Form_Load() frFirst.Visible = False '' The frame needs to be invisible End Sub
Although this doesn't move the frame from one form to the other it emulates the feeling of doing it, adding all the controls on both frames and setting the values respectively in tmrUpdate
•
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
It works for me 
All you should have to do, is modify your sub to contain a doevents, here is the modification:
Let me know if the doevents fixes your problem. It worked fine on the project I just created and tested.
ps: If you could do me a big favor, and in the future when you post code, add CODE tags around your code. It keeps it formatted and readable. My above post of code is in code tags. IE (with no spaces):
[ CODE ]
Your source code here
[ /CODE ]
Thanx in advance.

All you should have to do, is modify your sub to contain a doevents, here is the modification:
Sub WaitForMSecs(MSecsVar)
Dim Starttime As Single
Starttime = Timer
Do Until Timer >= Starttime + (MSecsVar / 1000)
Doevents ' <<--- Added This Line
Loop
End SubLet me know if the doevents fixes your problem. It worked fine on the project I just created and tested.
ps: If you could do me a big favor, and in the future when you post code, add CODE tags around your code. It keeps it formatted and readable. My above post of code is in code tags. IE (with no spaces):
[ CODE ]
Your source code here
[ /CODE ]
Thanx in advance. •
•
Join Date: Dec 2004
Location: Lincoln Park, Michigan
Posts: 1,744
Reputation:
Rep Power: 7
Solved Threads: 108
•
•
Join Date: May 2005
Location: United Kingdom
Posts: 11
Reputation:
Rep Power: 0
Solved Threads: 1
Hey, well let's see.
This is a new variable definition
This code comes under your Form_Load of the form.
This code comes under a timer with the interval set to 1
The above code would then after 500ms make frame 1 dissapear, 100ms after that frame 2 would dissapear and 50ms after that frame three will dissapear.
If you want frame 3 to dissapear 50ms after the program start, frame 2 at 100ms and frame 3 at 500ms you would have to use this under the timer rather.
Hope this helps you, that is if I understand correctly.
This is a new variable definition
Dim mCount As Double
Count = 0 fraOne.Visible = True fraTwo.Visible = True fraThree.Visible = True
Count = Count + 1
If Count = 500 Then
fraOne.Visible = False
Else If Count = 600 Then
fraTwo.Visible = False
Else If Count = 650 Then
fraThree.Visible = False
End IfIf you want frame 3 to dissapear 50ms after the program start, frame 2 at 100ms and frame 3 at 500ms you would have to use this under the timer rather.
Count = Count + 1
If Count = 500 Then
fraOne.Visible = False
Else If Count = 100 Then
fraTwo.Visible = False
Else If Count = 50 Then
fraThree.Visible = False
End IfHope this helps you, that is if I understand correctly.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)






Linear Mode