I need help in working out a logic in my scroller application that would make it more resourceful. Its designed with vb.net 2012. The app has 2 labels. One for scrolling contents and the other to display something else like a header.
The text file has contents for different sections. See text file sample below:
ITD - 05/MAY/17 1:20pm - THERE WILL BE TEMPORARY NETWORK OUTAGE IN COMPUTER ROOM FROM 10AM FOR MAINTENANCE WORK
HSE - 01/MAY/17 1:20pm - SAFETY ALERT: ONGOING CONSTRUCTION WORK AT THE WALKWAY. PLEASE DO NOT USE THE WALKWAY TO AVOID INJURIES
GENERAL - 07/Apr/17 2:00pm - PUBLIC HOLIDAYS HAS BEEN SCHEDULED FOR OCT 1st 2017
A distinctive phrase is placed at the beginning of each sentence to identify the source of the information.
The scroller application pulls information from the text file with the file.readalltext method. See code below
lblScroller.Text = File.ReadAllText(FILE_NAME).Replace(vbCr & vbLf, " ")
Then a code scrolls the contents in the label from right to left continuously.
I want to know how to check when a particular text or string scrolls into display on the label control and then the other label would also change to the name of the section.
For example, the app would check when the string
HSE scrolls into display, the other label would change to HSE. Users will then know that the information scrolling is from HSE. When the string GENERAL scrolls in, the label then changes to GENERAL so users would know that the information scrolling in is from GENERAL.
What I have tried:
I had taught of using different text files for each section or departments but it didn't work effectively because I had to use timers for different streamreaders for each text files. But if the content of a text file is large then the timer would not allow all the content to finish scrolling before it elapse and triggers the next streamreader.
I have tried using the 'contains' method to check for unique phrase and it always return true because streamreader loads the whole content of the file into the label control at once.
If I could be able to programmatically tell when a phrase or word just scrolls in from the beginning then the other label would indicate the source of the information.
Its like the normal TV Station scrolling news with different sections. E.g When sports information is scrolling in, a label at the far left changes to SPORTS.