DarkMercenary44
Technical User
I can't get this to work for some reason. I've gotten the actual code to work, but I got tired of having to have the same code in like 8 different locations in my project file. I want to create a sub that will do it. What it does is take in text that the user entered, and then displays it on the screen as if it was being typed out on a terminal, scrolling accross the screen. I'm using it for my encryption suite. Here's the variable that need passed.
label(index)-This is the begining of the array, index is 0. Only one on the form at this time.
frm-I think i need this in there so that the sub knows which form to put the new labels on.
text-text to display in window
starttop-Top position to start at
startleft-Left position to start at
maxtop-max top position the new controls can reach
maxleft-max left position the new controls can reach
I tried this:
Public Sub typetext(label as control, text as string, frm as form, maxtop as integer, maxleft as integer,optional starttop as integer,optional startleft as integer}
I even tried replacing label1 as control with
label1(integer) as control, but that didn't work either.
Public Sub typetext()
a = 1
c = 1
lenght = Len(Text1.Text) 'gets lenght of string
Do While a <= lenght
llet = Left(Text1.Text, a) 'gets all letters to pos a
rlet = Right(llet, 1) 'gets the last letter of llet
If rlet = "|" Then 'looks for | in rlet
oldtop = Label1(0).Top 'stores old top pos
Label1(0).Top = oldtop + 195 'sets new top pos
c = 1 'resets horz pos
rlet = ">" 'makes the | disappear
End If
lrlet = LCase(rlet)
Load Label1(a) 'loads new instance of label1
Debug.Print a
With Label1(a)
.BackColor = &HC000& 'sets cusor backcolor
.Top = Label1(0).Top 'sets cusor top
.Left = Label1(0).Left + (105 * c) 'sets cusor left
.Visible = True 'shows cursor
.Refresh 'force refresh
End With
b = 0
Do While b <= 10000 'acts as a timer so not to fast
b = b + 1
Loop
With Label1(a)
.BackColor = vbBlack 'undoes cursor colors
.Caption = lrlet 'sets caption of character
.Refresh 'forced refresh
End With
a = a + 1
c = c + 1
Loop
End Sub
theres the code I haven't change any of it to reflect the new variables yet, I have when I tried to use it, but i figured it would be better for you to see it in its workable state.
Thanks for any help you can give
DarkMercenary
darkmercenary44@earthlink.net
In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows
label(index)-This is the begining of the array, index is 0. Only one on the form at this time.
frm-I think i need this in there so that the sub knows which form to put the new labels on.
text-text to display in window
starttop-Top position to start at
startleft-Left position to start at
maxtop-max top position the new controls can reach
maxleft-max left position the new controls can reach
I tried this:
Public Sub typetext(label as control, text as string, frm as form, maxtop as integer, maxleft as integer,optional starttop as integer,optional startleft as integer}
I even tried replacing label1 as control with
label1(integer) as control, but that didn't work either.
Public Sub typetext()
a = 1
c = 1
lenght = Len(Text1.Text) 'gets lenght of string
Do While a <= lenght
llet = Left(Text1.Text, a) 'gets all letters to pos a
rlet = Right(llet, 1) 'gets the last letter of llet
If rlet = "|" Then 'looks for | in rlet
oldtop = Label1(0).Top 'stores old top pos
Label1(0).Top = oldtop + 195 'sets new top pos
c = 1 'resets horz pos
rlet = ">" 'makes the | disappear
End If
lrlet = LCase(rlet)
Load Label1(a) 'loads new instance of label1
Debug.Print a
With Label1(a)
.BackColor = &HC000& 'sets cusor backcolor
.Top = Label1(0).Top 'sets cusor top
.Left = Label1(0).Left + (105 * c) 'sets cusor left
.Visible = True 'shows cursor
.Refresh 'force refresh
End With
b = 0
Do While b <= 10000 'acts as a timer so not to fast
b = b + 1
Loop
With Label1(a)
.BackColor = vbBlack 'undoes cursor colors
.Caption = lrlet 'sets caption of character
.Refresh 'forced refresh
End With
a = a + 1
c = c + 1
Loop
End Sub
theres the code I haven't change any of it to reflect the new variables yet, I have when I tried to use it, but i figured it would be better for you to see it in its workable state.
Thanks for any help you can give
DarkMercenary
darkmercenary44@earthlink.net
In the real world
As in dreams
Nothing is quite
What it seems
:Book of Counted Sorrows