Scrolling text

How to make a programe to make a sentence to scroll accross the screen i a repeated fashion
thanks
abidrAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
InteqamConnect With a Mentor Commented:
Now increase the points and answer the question , make it an A please :0)
, and tell me what you want exactly from the picture ,
put three text boxed in a form , try to let one of them virtical, and put two timers , and two command buttons ,
and a label , then paste the followin in the form code:

Private strt As String
Private eno As Boolean
Private Sub Command1_Click()
If Len(Text1.Text) > 0 Then
    split (Text1.Text)

    While Label1.Height + 50 <= Text2.Height
        Text2.Text = Text2.Text + vbCrLf
        Label1.Caption = Text2.Text
    Wend
    Timer1.Enabled = True
    Label1.Caption = "" 
End If
End Sub

Private Sub Command2_Click()
If Len(Text1.Text) > 0 Then Text3.Text = Text1.Text
    While Label1.Width + 50 <= Text3.Width
        Text3.Text = Text3.Text + " "
        Label1.Caption = Text3.Text
    Wend
    Timer2.Enabled = True
    Label1.Caption = "" 
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer2.Enabled = False
    Label1.AutoSize = True
    Label1.Visible = False
    Label1.Caption = "" 
    Label1.Width = 70
    Label1.Height = 30
    Text2.Locked = True
    Text3.Locked = True
    Command1.Caption = "Scroll v"
    Command2.Caption = "Scroll h"
    Text1.Text = "" 
    Text2.Text = "" 
    Text3 = "" 
    
    Timer1.Interval = 500  ' you can change here as to change the speed of scrolling
    Timer2.Interval = 500
End Sub

Private Sub Timer1_Timer()
    Dim npos As Integer
    
    strt = Text2.Text
    npos = InStr(1, strt, vbCrLf, vbTextCompare)
    strt = Right(strt, Len(strt) - npos - 1) + Left(strt, npos + 1)
    Text2.Text = strt
End Sub

Private Sub split(strt As String)
    Dim i As Integer
    Dim ch As String
    Text2 = Mid(strt, 1, 1)
    For i = 2 To Len(strt)
        ch = Mid(strt, i, 1)
        Text2.Text = Text2.Text + vbCrLf + ch
    Next
    
End Sub

Private Sub Timer2_Timer()
strt = Text3.Text
strt = Right(strt, Len(strt) - 1) + Left(strt, 1)
Text3.Text = strt
End Sub
0
 
rayfordCommented:
You use the timer control to cause a repeated event to be triggered.  In the event you simply take the text in the text box and make it scroll.  

What delay you set the timer to will determine the scroll speed.  To remove video speed from the display update factor (varies from PC to PC) you should do a text1.refresh after updating it to ensure it is redrawn before resetting the delay.

The timer event will need to reset its delay everytime to be triggered again repeatedly this is where the loop is generated.
The text itself could easily be circled/scrolled by a command like this:

ABC$= Right(ABC$,len(ABC$)-1) & LEFT(ABC$,1)
Text1=ABC$
0
 
abidrAuthor Commented:
thanks
Itried to think how this is done, but due to my ltd knowledge I failed, can u give a code to try with explaining the timer and how i can link the text code  with it
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
InteqamCommented:
put three text boxed in a form , try to let one of them virtical, and put two timers , and two command buttons ,
and a label , then paste the followin in the form code:

Private strt As String
Private eno As Boolean
Private Sub Command1_Click()
If Len(Text1.Text) > 0 Then
    split (Text1.Text)

    While Label1.Height + 50 <= Text2.Height
        Text2.Text = Text2.Text + vbCrLf
        Label1.Caption = Text2.Text
    Wend
    Timer1.Enabled = True
    Label1.Caption = ""
End If
End Sub

Private Sub Command2_Click()
If Len(Text1.Text) > 0 Then Text3.Text = Text1.Text
    While Label1.Width + 50 <= Text3.Width
        Text3.Text = Text3.Text + " "
        Label1.Caption = Text3.Text
    Wend
    Timer2.Enabled = True
    Label1.Caption = ""
End Sub

Private Sub Form_Load()
    Timer1.Enabled = False
    Timer2.Enabled = False
    Label1.AutoSize = True
    Label1.Visible = False
    Label1.Caption = ""
    Label1.Width = 70
    Label1.Height = 30
    Text2.Locked = True
    Text3.Locked = True
    Command1.Caption = "Scroll v"
    Command2.Caption = "Scroll h"
    Text1.Text = ""
    Text2.Text = ""
    Text3 = ""
   
    Timer1.Interval = 500  ' you can change here as to change the speed of scrolling
    Timer2.Interval = 500
End Sub

Private Sub Timer1_Timer()
    Dim npos As Integer
   
    strt = Text2.Text
    npos = InStr(1, strt, vbCrLf, vbTextCompare)
    strt = Right(strt, Len(strt) - npos - 1) + Left(strt, npos + 1)
    Text2.Text = strt
End Sub

Private Sub split(strt As String)
    Dim i As Integer
    Dim ch As String
    Text2 = Mid(strt, 1, 1)
    For i = 2 To Len(strt)
        ch = Mid(strt, i, 1)
        Text2.Text = Text2.Text + vbCrLf + ch
    Next
   
End Sub

Private Sub Timer2_Timer()
strt = Text3.Text
strt = Right(strt, Len(strt) - 1) + Left(strt, 1)
Text3.Text = strt
End Sub

0
 
abidrAuthor Commented:
thanks a lot, tell me Is there a chance to scroll an icon image before the text, if it is possible please let me know to increase your points.
0
 
InteqamCommented:
you mean the wuestion is mine?

0
 
InteqamCommented:
if yes , then let me answer the question and increase the points , and i will try to do what you asked.

0
 
abidrAuthor Commented:
hi : Inteqam, yes you helped a lot, how can the question be yours tell me how & i will increase the points you want
thanks
0
 
InteqamCommented:
well, did dayford answer satisfy you , if yes , post another question titles for inteqam , with points , i'll answer it , if no   , reject the answer , and increase the points , and i'll try to find you a solution for the image.

0
 
abidrAuthor Commented:
I can say he did not due to my ltd knowledge
0
 
abidrAuthor Commented:
it is increased by another 20

0
 
abidrAuthor Commented:
thanks, i have increased the points from 20 to 40, if you want more tell me. Now for the image, i need an image to scrol in the same horizental text box scroll or before it or after it to display an image to go with the message, the scroll rate should be the same as the text.

thanks
0
 
InteqamCommented:
what is the width and hight of the image ,

And BTW :

for the points , I Am respecting you generous .
:0)

0
 
abidrAuthor Commented:
100x100 pix - 200x200 max
0
 
abidrAuthor Commented:
hello, where are u ... i hope u R OK
0
 
InteqamCommented:
sorry ,
but it seems that there is a problem here ,

i didn't recieve any emails except the one who tells that i have a Good answer ,

sorry again , because i tried the image and i failed.

sorry again

Yours :
  Inteqam

0
 
abidrAuthor Commented:
oh no problem
0
All Courses

From novice to tech pro — start learning today.