|
|
Subject:
Word scrolling (moving) across the form - VB6
Category: Computers > Programming Asked by: jstm-ga List Price: $20.00 |
Posted:
11 Mar 2005 18:28 PST
Expires: 10 Apr 2005 19:28 PDT Question ID: 492995 |
I would like to have a phrase scroll across my form during runtime. I would like it to slowly appear one letter at a time from the left of screen and move towards the right of screen. As the phrase reaches the right of screen it will disappear one letter at a time? |
|
There is no answer at this time. |
|
Subject:
Re: Word scrolling (moving) across the form - VB6
From: willcodeforfood-ga on 11 Mar 2005 20:43 PST |
Here is a sample that demonstrates a very simple way to accomplish your objective. Start with a new form. Add a label called Label1 to your form and a timer called Timer1. Then add the following code to the form. I set the timer interval to 200 to test this. ========================== begin code Dim msg(11) As String Dim idx As Integer Private Sub Form_Load() msg(0) = "Hello World " msg(1) = "ello World H" msg(2) = "llo World He" msg(3) = "lo World Hel" msg(4) = "o World Hell" msg(5) = " World Hello" msg(6) = "World Hello " msg(7) = "orld Hello W" msg(8) = "rld Hello Wo" msg(9) = "ld Hello Wor" msg(10) = "d Hello Worl" msg(11) = " Hello World" msg(11) = " Hello World " idx = 0 Label1.Caption = msg(idx) End Sub Private Sub Timer1_Timer() idx = idx + 1 If idx > 11 Then idx = 0 Label1.Caption = msg(idx) End Sub ========================== end code This code can be optimized and cleaned up some once you get the gist and want to improve on it. For example, you could dynamically calculate each of the array elements and that would make the code smaller and allow it to be custom text, rather than static text. Good luck. |
Subject:
Re: Word scrolling (moving) across the form - VB6
From: jstm-ga on 11 Mar 2005 21:15 PST |
THANKS AGAIN!!! I APPRECIATE YOUR HELP. |
Subject:
Re: Word scrolling (moving) across the form - VB6
From: willcodeforfood-ga on 11 Mar 2005 23:21 PST |
Here's the answer to the measuring the time interval between two button clicks: I used buttons called Command1 and Command2, and text boxes called Text1, Text2 and Text3. The trick is to use now() rather than time(). You need the date part because a timespan may span accross midnight. Hopefully you don't have to measure machine downtime that goes overnight very often, but you never know. By the way, did you ever figure out how to do the thing with the PLC? If not, let me know the model of the PLC and maybe I can assist. ================================= begin code Private Sub Command1_Click() Text1.Text = Now() End Sub Private Sub Command2_Click() Text2.Text = Now() ShowElapseTime End Sub Private Sub ShowElapseTime() Dim secs, mins, hours As Long Dim total As String secs = DateDiff("s", CDate(Text1.Text), CDate(Text2.Text)) total = "" mins = Fix(secs / 60) secs = secs Mod 60 hours = Fix(mins / 60) mins = mins Mod 60 total = hours & ":" If mins < 10 Then total = total & "0" total = total & mins total = total & ":" If secs < 10 Then total = total & "0" total = total & secs Text3.Text = total End Sub ================================= end code |
If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you. |
Search Google Answers for |
Google Home - Answers FAQ - Terms of Service - Privacy Policy |