i am creating a teleprompter software. i want the following things
1. scrolling text smoothly in a picturebox from bottom to top and vice versa from top to bottom.
2. the speed of scrolling text should be adjustable to the maximum and minimum.
Printable View
i am creating a teleprompter software. i want the following things
1. scrolling text smoothly in a picturebox from bottom to top and vice versa from top to bottom.
2. the speed of scrolling text should be adjustable to the maximum and minimum.
Hi,
Here is the logic for moving text smoothly in your picturebox
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private gmloop As Boolean Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Dim UpDown As Integer Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 10 strStr = "Hello this is your Text" & vbCrLf & "Hello how are you " & vbCrLf & " " UpDown = 1 While Not gmloop DoEvents If GetTickCount - tmp > 50 Then Picture1.Cls tmp = GetTickCount Picture1.CurrentY = i Picture1.Print strStr i = i + UpDown If i < -10 Or i > Picture1.ScaleHeight Then UpDown = -UpDown End If Wend End End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub
To change the speed
Modify the the code ...
VB Code:
If GetTickCount - tmp > 50 Then
Change To
VB Code:
If GetTickCount - tmp > tDelay Then ' Control the value of tDelay using a Scroll bar or whatever....
Regards,
Pradeep
the text is scrolling smoothly. but i have a problem. when i press the up arrow key it should scroll up and when i press the down arrow key it should scroll down from the current scrolling line. By default the text should start scrolling from bottom to top. i would of great help if u could solve this.i require it very urgently.
Hi,
Here it is..
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private gmloop As Boolean Dim UpDown As Integer Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 10 strStr = "Hello this is your Text" & vbCrLf & "Hello how are you " & vbCrLf & " " i = Picture1.ScaleHeight UpDown = 1 While Not gmloop DoEvents If GetTickCount - tmp > 50 Then Picture1.Cls tmp = GetTickCount Picture1.CurrentY = i Picture1.Print strStr i = i + UpDown If i < -10 Or i > Picture1.ScaleHeight Then UpDown = -UpDown End If Wend End End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = -1 Case vbKeyDown UpDown = 1 End Select End Sub
the up and down arrow keys are working perfectly. but why is the text bouncing back if it reaches the top and bottom of the picturebox. actaually i would be loading a large text file. So the text should keep scrolling from bottom to top till it reaches the last line of the text. i should not bounce back when it reaches the border of the picturebox. even while scrolling from top to bottom it is the same. i hope u would have understood. this is for news reading purpose. the reader should keep on reading the text as it scrolls from bottom to top.
quicky glancing over the code, removing this line might do the trick:
VB Code:
If i < -10 Or i > Picture1.ScaleHeight Then UpDown = -UpDown
Hi ayesha16,
I guess you requirements were..
You have mentioned vice versa..Quote:
Originally posted by ayesha16
i am creating a teleprompter software. i want the following things
1. scrolling text smoothly in a picturebox from bottom to top and vice versa from top to bottom.
2. the speed of scrolling text should be adjustable to the maximum and minimum.
Are you new to VB...?.... If not.. I guess you can change the code..
If not let me know I will do it at my leisure...
Please give me your exact requirements.
Regards,
Pradeep
Hi,
My exact requirements are as follows. Actually i am doing a teleprompter software for news reading purpose. This should be in the form of a text editor. I would be loading a Txt file in a picturebox.Once i press the space bar the text should scroll smoothly in the picturebox from bottom to top. this is done so that the news reader could read the scrolling text till the last line of text file. it is possible to stop the scrolling text in the middle. So in order to stop the scrolling text the space bar should be pressed. the space bar should be pressed again to continue scrolling. the up and down arrow keys should be used to either scroll text upwards or downwards from the current line which i alredy mentioned. the left and right arrow keys should be used to increase and decrese the speed. since this is a teleprompter software there would be mirror in front of the teleprompter machine. So the reader would not be able to read in the proper order in the mirror. i would be reversed. so there should be a method to reverse the scrolling text with a mirrored font as well. hope u would have understood what i want here. when i press F9 key the mirror image of the scrolling text should be visible which could be readable when it reflects on a mirror. When i press F8 key agin the original scrolling text should be seen. These are my requirements. Please help me out. Iam new to VB. i require this urgently.
OK..
I dont know how to do the mirroring of the text...
Well you better install a reversed fonts (I dont know where you could find them.. though..)
I will send you the rest of the code..
As far as I know, "TelePrompter" is a trade name; so be careful what you call this thing and check that you're not infringing any patents?
Hi,
Create a text file C:\yourtxtfile.txt
and put your text there...
Press up arrow to scroll down and down to scroll up...
left to accelerate and down to decelerate..
Keep the keys pressed else it will stop...
Inverting the fonts... :confused:
Better install a inverted fonts and set it as the font for your picture box..
Instead of picture box you could have very well used a text box.. :)
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private gmloop As Boolean Dim UpDown As Single Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Dim st As String Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 10 Open "C:\yourtxtfile.txt" For Input As #1 While Not EOF(1) Line Input #1, st strStr = strStr & vbCrLf & st Wend Close #1 i = Picture1.ScaleHeight UpDown = 1 While Not gmloop DoEvents If GetTickCount - tmp > 50 Then Picture1.Cls tmp = GetTickCount Picture1.CurrentY = UpDown Picture1.Print strStr End If Wend End End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = UpDown + 1 Case vbKeyDown UpDown = UpDown - 1 Case vbKeyLeft UpDown = UpDown / 0.9 Case vbKeyRight UpDown = UpDown / 1.1 If UpDown = 0 Then UpDown = 0.1 End Select End Sub
the earlier coding which u sent was correct.it should scroll continously with the up and down arrow keys. But there is a problem here. when u load the text file all the contents of the file are loaded in a single line. how to word wrap the contents in a picturebox.
how to start and stop scrolling when i press space bar which i mentioned earlier.Once i press the space bar the text should scroll smoothly in the picturebox from bottom to top. this is done so that the news reader could read the scrolling text till the last line of text file. it is possible to stop the scrolling text in the middle. So in order to stop the scrolling text the space bar should be pressed. the space bar should be pressed again to continue scrolling.
Ho.... Sorry..
But I have to say that..
You are making me do the next "teleprompter software".
:)
Partially Done..
Try this one....
The wordwrap is also done.. but maybe you could improve the logic...
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private gmloop As Boolean Dim UpDown As Single Dim mv As Integer Dim speed As Integer Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Dim st As String Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 10 speed = 50 Open "C:\yourtxtfile.txt" For Input As #1 While Not EOF(1) Line Input #1, st st = splt(st) strStr = strStr & vbCrLf & st Wend Close #1 strStr = strStr & vbCrLf & " " i = Picture1.ScaleHeight UpDown = -1 While Not gmloop DoEvents If GetTickCount - tmp > speed Then Picture1.Cls tmp = GetTickCount Picture1.CurrentY = i Picture1.Print strStr i = i + UpDown * mv End If Wend End End Sub Private Function splt(strStr As String) Dim l As Long Dim tmpStr As String Dim StrS As String l = Len(strStr) * 10 StrS = strStr If l < Picture1.ScaleWidth Then splt = strStr: Exit Function For k = Picture1.ScaleWidth To l Step Picture1.ScaleWidth tmpStr = Mid$(StrS, k / 10) StrS = Mid$(StrS, 1, k / 10) StrS = StrS & vbCrLf & tmpStr Next splt = StrS End Function Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = -1 Case vbKeyDown UpDown = 1 Case vbKeyLeft speed = speed - 1 If speed < 5 Then speed = 5 Case vbKeyRight speed = speed + 1 If speed > 500 Then speed = 500 Case vbKeySpace mv = mv + 1 mv = mv Mod 2 End Select End Sub
Regards,
Pradeep
Hi,
See this..
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private gmloop As Boolean Dim UpDown As Single Dim mv As Integer Dim speed As Integer Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Dim st As String Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 10 speed = 50 Open "C:\yourtxtfile.txt" For Input As #1 While Not EOF(1) Line Input #1, st st = FormatText(st, 7) st = splt(st) strStr = strStr & vbCrLf & st Wend Close #1 strStr = strStr & vbCrLf & " " i = Picture1.ScaleHeight UpDown = -1 While Not gmloop DoEvents If GetTickCount - tmp > speed Then Picture1.Cls tmp = GetTickCount Picture1.CurrentY = i Picture1.Print strStr i = i + UpDown * mv End If Wend End End Sub Private Function splt(strStr As String) Dim l As Long Dim tmpStr As String Dim StrS As String l = Len(strStr) * 10 StrS = strStr If l < Picture1.ScaleWidth Then splt = strStr: Exit Function For k = Picture1.ScaleWidth To l Step Picture1.ScaleWidth tmpStr = Mid$(StrS, k / 10) StrS = Mid$(StrS, 1, k / 10) StrS = StrS & vbCrLf & tmpStr Next splt = StrS End Function Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = -1 Case vbKeyDown UpDown = 1 Case vbKeyLeft speed = speed - 1 If speed < 5 Then speed = 5 Case vbKeyRight speed = speed + 1 If speed > 500 Then speed = 500 Case vbKeySpace mv = mv + 1 mv = mv Mod 2 End Select End Sub Private Function FormatText(sString As String, WordsPerLine As Integer) As String Dim MyArray() As String, NewString As String NewString = Replace(sString, " ", " ") MyArray = Split(NewString, " ") NewString = "" For i = 0 To UBound(MyArray) j = j + 1 If j > WordsPerLine Then NewString = NewString & " " & MyArray(i) & "" & vbCrLf & "" j = 0 Else NewString = NewString & " " & MyArray(i) End If Next FormatText = NewString End Function
Wow.. finally i have done.. all your requirements...
Have a look..
There is mirror image of the text also...
Regards,
Pradeep
everthing is working perfectly but why is the speed of the scrolling text so slow. even if i increase it to the maximum it is very slow.
Hi,
Speed is controlled.. using left arrow and right arrow..
what is your machine RAM and CPU Speed.
I am able to control the speed...
Happy Programming.... :)
Regards,
Pradeep
the speed could be controlled. but the scrolling text is not scrolling smoothly there is a jerk. the coding which u had first sent had a very smooth scrolling also the speed was very fast. please check up the first coding and see the difference which i meant even if the speed is increased.
Hi Ayesha,
Since I am reversing the Picture.. it is taking time..
Please comment the code..
for reversing and run..
Regards,
Pradeep
So how do i solve the problem of scrolling speed by having both.
Hi,
You are indeed a Great Manager..
I have to say it..
Compromise on smoothness..
VB Code:
Private Declare Function GetTickCount& Lib "kernel32" () Private Declare Function GetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long) As Long Private Declare Function SetPixel Lib "gdi32" (ByVal hdc As Long, ByVal X As Long, ByVal Y As Long, ByVal crColor As Long) As Long Private gmloop As Boolean Dim UpDown As Single Dim mv As Integer Dim speed As Single Private Sub Form_Load() Dim i As Integer Dim strStr As String Dim tmp As Long Dim st As String Me.ScaleMode = 3 Picture1.ScaleMode = 3 Me.Show Picture1.CurrentX = 250 speed = 1 Open "C:\yourtxtfile.txt" For Input As #1 While Not EOF(1) Line Input #1, st st = FormatText(st, 7) st = splt(st) strStr = strStr & vbCrLf & st Wend Close #1 strStr = strStr & vbCrLf & " " i = bg.ScaleHeight - 20 UpDown = -1 mv = 1 While Not gmloop DoEvents If GetTickCount - tmp > 100 Then Picture1.Cls bg.Cls tmp = GetTickCount bg.CurrentY = i bg.Print strStr bg.Refresh drawInverse i = i + UpDown * mv * speed End If Wend End End Sub Private Sub drawInverse() Dim i As Long Dim j As Long Dim k As Long For i = 0 To Picture1.ScaleHeight For j = 0 To Picture1.ScaleWidth k = GetPixel(bg.hdc, Picture1.ScaleWidth - j, i) If k <> vbBlack Then SetPixel Picture1.hdc, j, i, k Next Next Picture1.Refresh End Sub Private Function splt(strStr As String) Dim l As Long Dim tmpStr As String Dim StrS As String l = Len(strStr) * 10 StrS = strStr If l < Picture1.ScaleWidth Then splt = strStr: Exit Function For k = Picture1.ScaleWidth To l Step Picture1.ScaleWidth tmpStr = Mid$(StrS, k / 10) StrS = Mid$(StrS, 1, k / 10) StrS = StrS & vbCrLf & tmpStr Next splt = StrS End Function Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) gmloop = True End Sub Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = -1 Case vbKeyDown UpDown = 1 Case vbKeyLeft speed = speed * 0.9 Case vbKeyRight speed = speed / 0.9 Case vbKeySpace mv = mv + 1 mv = mv Mod 2 End Select End Sub Private Function FormatText(sString As String, WordsPerLine As Integer) As String Dim MyArray() As String, NewString As String NewString = Replace(sString, " ", " ") MyArray = Split(NewString, " ") NewString = "" For i = 0 To UBound(MyArray) j = j + 1 If j > WordsPerLine Then NewString = NewString & " " & MyArray(i) & "" & vbCrLf & "" j = 0 Else NewString = NewString & " " & MyArray(i) End If Next FormatText = NewString End Function
this is still not smooth like how the original was.there is a jerk while scrolling
is it not possible to have a single picture box and obtain th mirror image of text in that picturebox. i had already mentioned that when the text is scrolling if i press F9 the mirror image of the text should appear and if i press F8 the original text should scroll.
I guess you can do it..
If you need only one picture box , hide the other at runtime.
i.e make
VB Code:
bg.visible = False
To handle f9 f8 key inputs
add few lines in the below code..
vbKeyF8
vbKeyF9
Try learning from the code..
VB Code:
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp
but what about the speed in picture1. the speed in bg is correct if i remove drawinverse. now i want the same speed in picture1 by making bg.visible=false.
what happened to the question i asked u earlier.
but what about the speed in picture1. the speed in bg is correct if i remove drawinverse. now i want the same speed in picture1 by making bg.visible=false.
i have another problem. u have given a fixed statement for load a file. but it is not a fixed file name. when i say load text file My documents folder shuld open and i should be able to select a file for scrolling.this cannot be used.
'Open "C:\My Documents\unity.txt" For Input As #1
' While Not EOF(1)
' Line Input #1, st
is this guy being paid or what?
he seems to have pretty much written your entire app, and you still want more!
there is helping with a problem and there is writing the thing for you. i think this is a case of the latter.
Just "I need"
no your not. apparently pradeepkrao is though :rolleyes:Quote:
Originally posted by ayesha16
i am creating a teleprompter software. i want the following things
have you ever written an application in your life?
Ha ha ha ha :D
Yeah kleinma I endedup in creating a new TelePrompter Software..
:(
don't get me wrong since i've been using these forums i've asked for a lot of help, sometimes several times per project. but i always post as a last resort, and i always make sure i understand the answers posted.
i certainly wouldn't do what this bloke has done on this thread and keep asking someone to write a program.
i can't believe pradeepkrao put up with it. i would have been tempted to put some file deletes into the code just to check if ayesha16 actually understand the code before blindly running it. (but then i can be vindictive).
by the way pradeepkrao i think your app is excellent.
Hi,
thank u very much Mr.PradeepKRao for all the help. It is silly of me to keep on asking questions. But i cannot help it. B'coz i am new to VB i had to ask u. Actuallu i have various other features to be included in this software. What i asked u is only 25% of my project. Iam really sorry if i have hurt u by any means. But the code u had sent me was really helpful to a large extent. If u dont mind could u do a final favour for me.and i should be able to select a file for scrolling from the mydocuments folder instead of using a standard file.this cannot be used.
'Open "C:\My Documents\unity.txt" For Input As #1
' While Not EOF(1)
' Line Input #1, st
if it is possible please help me out with this alone and i would be very grareful to u.
Thanks.Quote:
by the way pradeepkrao i think your app is excellent.
ayesha16 dont feel bad, keep a positive attitude.
Yes your requirement is use a file select feature..
You may use a Common Dialog Control.
You might be going Bonkers when I said Common Dialog Control.
Any way I will do it and post it to you.
I am basically jobless . :D
Regards,
Pradeep
Hi Ayesha,
Check it out..
I have learnt VB using this site.
I joined this forum 2 years back and I dint even know how to Open a VB IDE forget about programming.
I consider forums are the best place to learn.
I suggest you to learn here.
Regards,
Pradeep
There is no Shortcut for Hard Work
:)
thank u very much for the new code.but if command buttons are placed it is not possible to use the space bar,upand down arrow keys and right and left arrow keys. So i placed a menu bar and put the file select option in the menu bar. the run option i placed it in the enter key code. So this was working but the space bar was not working to stop and scroll again b'coz if i press the space bar the form gets unloaded. also i want the font size to be
48 and font name should be Arial Black. if i do this change then the scrolling text apears jumbled up with overlapping letters and it starts scrolling from middle of the text file. so could u please suggest a remedy for this.
Please make sure that the focus is on the right Picture Box.
Change the fot of the bg Picture box to whatever you want.
See the code for its KeyDown event you might have to modify it..
VB Code:
Private Sub Picture1_KeyDown(KeyCode As Integer, Shift As Integer) Select Case KeyCode Case vbKeyUp UpDown = -1 Case vbKeyDown UpDown = 1 Case vbKeyLeft speed = speed * 0.9 Case vbKeyRight speed = speed / 0.9 Case vbKeySpace ' This handles the Space key Press Event mv = mv + 1 mv = mv Mod 2 End Select End Sub
By the way are you a student or a proffesional. ?.
Regards,
Pradeep
sorry to tell u but this doesn't work if i increase the font size
Hi,
Chk it out..
Regards,
Pradeep
Finally i solved the problem.Thank u very much for the help provided by u. It was really very useful. it was a great application created by u.
So you could finally Learn some thing from that application.... Great!!.. :cool:Quote:
Finally i solved the problem.Thank u very much for the help provided by u. It was really very useful. it was a great application created by u.
Hi,
Sorry for troubling u again. I have another major problem again. Actally the text is by default aligned to the left. but i want it to be aligned in the center. How do i do it. Could u please help me out in this. Thanks.
I dont think that there is a direct method...
What you need to do is get the length of the text and then decide the PictureBox1.CurrentX value, this should be calculated..
Please post another question on how to put a text center to the picturebox.
Meanwhile I'll try... :D
Regards,
Pradeep
iam sending u a code.please check this out to center align text in picturebox. But i dont know how to implement this code in the code which u already sent.Just paste this code in a vb form along with a picturebox called picBox and a command button.
Private Const strData As String = "This is a sample text that should perhaps run " & _
"into more than three lines depending on the font " & _
"that is used to display the text in this picturebox." & _
"The technique I would suggest is to read this text into a " & _
"variable and split by a space and then print onto this " & _
"picture box depending on the position of the current " & _
"pixel in relation to the current font's TextHeight and/or TextWidth"
Private Sub Command1_Click()
Dim strDataArray() As String
Dim strToPrint As String
strDataArray = Split(strData, " ", -1, vbBinaryCompare)
i = 0
Do
If i > UBound(strDataArray) Then
Exit Do
End If
Do
If i > UBound(strDataArray) Then
Exit Do
End If
If (picBox.CurrentX + picBox.TextWidth(strToPrint & strDataArray(i))) > (picBox.ScaleWidth) Then
'i = i + 1
Exit Do
End If
strToPrint = strToPrint & strDataArray(i) & " "
picBox.CurrentX = (picBox.ScaleWidth - (picBox.TextWidth(strToPrint))) / 2
i = i + 1
Loop
picBox.Print strToPrint
strToPrint = ""
picBox.CurrentX = 0
Loop
End Sub
Private Sub Form_Load()
With picBox
.ScaleMode = vbPixels
.Font.Name = "Century Gothic"
.Font.size = 10
.Font.Bold = True
.Font.Italic = True
.AutoRedraw = True
End With
End Sub
The code works fine..
What you can do is read the code which I have sent you earlier and then try to think where you can insert this one.
ofcourse you can insert this piece of code in my code...
I dont want to do the whole thing, my intension is that you have to learn, give it a try else you will end up learning nothing.
Take this as an advice.
Hi,
good to know that u want me to learn something. But before i could post u this code and question i had already tried implementing it. the code gets hanged up in the middle and iam not able proceed further.
Ok... You send me what you have done.. I will have a look into it..
:D
Private Sub cmdRun_Click()
Dim i As Integer
Dim strStr As String
Dim tmp As Long
Dim st As String
'
Me.ScaleMode = 3
Picture1.ScaleMode = 3
Me.Show
Picture1.CurrentX = 250
speed = 1
Open FileName For Input As #1
While Not EOF(1)
Line Input #1, st
st = FormatText(st, 5)
st = splt(st)
strStr = strStr & vbCrLf & st
Dim strDataArray() As String
Dim strToPrint As String
strDataArray = Split(strstr, " ", -1, vbBinaryCompare)
i2 = 0
Do
If i2 > UBound(strDataArray) Then
Exit Do
End If
Do
If i2 > UBound(strDataArray) Then
Exit Do
End If
If (bg.CurrentX + bg.TextWidth(strToPrint & strDataArray(i2))) > (bg.ScaleWidth) Then
'i = i + 1
Exit Do
End If
strToPrint = strToPrint & strDataArray(i) & " "
bg.CurrentX = (bg.ScaleWidth - (bg.TextWidth(strToPrint))) / 2
i2 = i2 + 1
Loop
bg.Print strToPrint
strToPrint = ""
bg.CurrentX = 0
Loop
Wend
Close #1
strstr=strtoprint
strStr = strStr & vbCrLf & " "
i = bg.ScaleHeight - 20
UpDown = -1
mv = 1
While Not gmloop
DoEvents
If GetTickCount - tmp > speed Then
Picture1.Cls
bg.Cls
tmp = GetTickCount
bg.CurrentY = i
bg.Print strStr
bg.Refresh
' drawInverse
i = i + UpDown * mv * speed
End If
Wend
End
End Sub
this is what i did.
The code which you had posted earlier (Center justification)does the job..
So you dont have to call the formatText and splt functions..
try doing it..
Regards,
Pradeep
does your code work any way..??....
I dont think so.....
See the first while loop (Reading from the file..)
It ends much before..
Simply read the whole data to an array and then perform the rest of formatting (Center justification logic..)
Are you able to make sense of what I am saying.. :D
Do it and come up with some results...
sorry iam not able to follow what u'r saying.please explain it clearly
hi,
i was able to do till this. but after this how do i start scrolling. this code just prints the text in the picturebox.
Dim strDataArray() As String
Dim strToPrint As String
Open FileName For Input As #1
While Not EOF(1)
Line Input #1, st
'st = FormatText(st, 7)
'st = splt(st)
strStr = strStr & vbCrLf & st
Wend
Close #1
'strStr = strStr & vbCrLf & " "
strData = strStr
strDataArray = Split(strData, " ", -1, vbBinaryCompare)
i = 0
Do
If i > UBound(strDataArray) Then
Exit Do
End If
Do
If i > UBound(strDataArray) Then
Exit Do
End If
If (bg.CurrentX + bg.TextWidth(strToPrint & strDataArray(i))) > (bg.ScaleWidth) Then
'i = i + 1
Exit Do
End If
strToPrint = strToPrint & strDataArray(i) & " "
bg.CurrentX = (bg.ScaleWidth - (bg.TextWidth(strToPrint))) / 2
i = i + 1
Loop
bg.Print strToPrint
strToPrint = ""
bg.CurrentX = 0
Loop
Quote:
Originally posted by pradeepkrao
I am basically jobless . :D
You shouldn't be.
You should find out for who ayesha16 is working, and try to convince them you'll do a better job if they hire you.
;)
Ha ha ha.. I have a Job and fortunately I do it well within schedule :D .Quote:
You shouldn't be.
You should find out for who ayesha16 is working, and try to convince them you'll do a better job if they hire you.
rest of the day you will find me in vbforums.. :).
This is where I learnt VB from scratch.. :).
I advice this to all.. :)
Hi Ayesha,
Use the logic (Center justification) every time you move the text (Up or Down)
Sorry to tell u that it is not working out.If it is possible for u to explain properly please help me as iam supposed to submit this work by tomorrow.B'coz of this problem iam not able to concentrate on the rest of the work which i have to complete.
What.....
Quote:
not able to concentrate on the rest of the work which i have to complete.
Sir/Madam,Quote:
If it is possible for u to explain properly please help me as iam supposed to submit this work by tomorrow
Please try to understand the code. Have a look at it..
It is not as hard as it looks, give it a try...
Right Now I am buzy .. I will post you later..
Ayesha, are you a student or is this a work project?
I'm thinking its probably the student one, because I cant see how you'd be in a position to be given this task at work with the little knowledge you have.
After all the help Pradeep has given you, the least you could do is include him in the applications credits, though you wont do that as a student because then you will fail.
Shame that.