i am trying to write a program in vb.net that will display text sequentially one word at a time in the centre of the screen. I have managed to split file into words but i am just stuck here lacking knowledge how to program the rest.
I would appreciate if someone has any ideas about it??
Please help me.
i have been trying this code. It only displays the last word in the file, but my idea is to display all words in the file one by one at the same place on the screen. i am trying to write a program which is similar to one@ this address http://wordflashreader.sourceforge.net/
what is your idea about it?
Dim filestream As StreamReader = New StreamReader("C:\sample.txt")
Dim readcontents As String
readcontents = filestream.ReadToEnd()
Dim textdelimiter As String
textdelimiter = " "
Dim splitout = Split(readcontents, textdelimiter)
Dim i As Integer
For i = 0 To UBound(splitout)
Label1.Text = splitout(i)
Thanks for replying Wayne
I have tried adding a timer in the loop with interval set to 1000ms in the properties
but it still shows the last word only. what else can i use to add delay.
> Use Form level array(say A) to hold all the words in a file
> Use form level integer to hold the current index(say ci)
> When Form loads read the words in the file and store it in the array (A), initialize Current index to 0, then Enable the timer
>Display the array content of current index (A(ci) )
>increament /Decrement the current index by 1 (To display next/previous word)
>Check the boundary Condition
I given the pseudo code, you develop the code using this.
Thanks for replying. i have managed to write the correct loop. but the porblem is it works fine in the console window(displays all words in a file sequentially) but if try to display words in a label then although there are no errors and it starts running but nothing comes up in the label and it just freezes for the duration of the text file being read.what do u think?
Please let me know
You have too many loops, you only need one. You also have to refresh your textbox. Try this:
Public Class Form1
Dim readcontents As String = "The quick brown fox jumps over the lazy dog"
Dim textdelimiter As String = " "
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'array for storing words
Dim splitout As String() = Split(readcontents, textdelimiter)
For i As Integer = 0 To UBound(splitout)
TextBox1.Text = splitout(i)