Hello,
Does anybody know how I can scroll a string in a single line of a Label or TextBox or StatusBar panel ?
Thank you,
Thierry
Printable View
Hello,
Does anybody know how I can scroll a string in a single line of a Label or TextBox or StatusBar panel ?
Thank you,
Thierry
In Textbox, you can control scrollbars with a property (scrollbars something). Just look at properties window at design time.
In fact, I want it to scroll automatically and continously as a message.
Thanks
Ah...Then maybe the simplest way is to put autosized label in a picturebox with BorderStyle of 0. Then just with a timer you get a scroll in it easily.
Code:Dim lblLeft As Integer
Private Sub Timer1_Timer()
lblLeft = lblLeft - 15
If lblLeft <= -Label1.Width Then lblLeft = Picture1.ScaleWidth
Label1.Move lblLeft, 0
End Sub
Sorry, having a bad headache at the moment...Hope I got it right now.
You can also try scrolling with textbox by changing it's SelStart value. It's not smooth if I remember right.
Code:'scrolling text
'need 1 label, 1 timer, 1 command button for this example
'
Option Explicit
Private Sub Command1_Click()
'will give user a Yes or No prompt in which they wish to exit
Dim x As Integer
x = MsgBox("Are you sure you want to exit?", vbYesNo, "Exit")
If x = 6 Then
End
End If
End Sub
Private Sub Form_Load()
'Will modify all the following controls when the project is run o
' r loaded
dim msg$ as string
msg$ = "This is a simple Marquee example that I've made." & vbCrLf
msg$ = msg$ & "You can make something 100 times better."
MsgBox msg$, vbYes, "Marquee Example of Scrolling Text"
Label1.Visible = True
Label1.Enabled = True
Form1.Enabled = True
Label1.Caption = Date
Label1.Left = 0
Label1.Top = 1800
Label1.Height = 255
Label1.Width = 1195
Command1.Top = 2400
Command1.Left = 0
Command1.Height = 375
Command1.Width = 6705
Command1.Caption = "Exit Example"
Command1.Enabled = True
Command1.Visible = True
Form1.Height = 3225
Form1.Width = 6810
Timer1.Enabled = True
Timer1.Interval = 1
End Sub
Private Sub Timer1_Timer()
If Label1.Left < -1000 Then
Label1.Left = 7000
Else
Label1.Left = Val(Label1.Left) - 40
End If
End Sub
Thanks for your replies.
I used a Timer control as follow :
Private Sub Timer_Timer()
k = k + 1
Label1.Caption = Left(lib, k)
If k = Len(lib) Then k = 0
End Sub
And it works fine !...
Thierry