Greetings,
A form has some serious performance issues which begin when the form is launched.
From the menu which simply shows the form, it appears instantly but is somewhat "half drawn" resulting in a graphical glitch a delay of around 10 seconds occurs until normal service is restored.
Now I know this is due to me populating 4 combo box from the files below (See stats):-
towns 40,166 lines
cities 664 lines
counties 49 lines
Phonecodes 676 lines
I wait until the form is show before starting off 4 background workers to ease the load and allow the main GUI form thread to be active.
Form shown event
Each background work reads the files into a string array (see below)
BackgroundWorker1_DoWork
Finally when the background process is finished populate the combobox.
BackgroundWorker1_RunWorkerCompleted
I was puzzled that the glitch appears even before the form is shown.
Does anyone have any ideas of how I can resolve the glitch?
The application backend is a MS database (*.accdb) and wondering if to make tables instead of reading the text files.
However tables containing just one field do seem pointless and note the address/phone code data is NOT RELATED.
Thanks
Rob
PS: Now I format my posts so they can be read easier
A form has some serious performance issues which begin when the form is launched.
From the menu which simply shows the form, it appears instantly but is somewhat "half drawn" resulting in a graphical glitch a delay of around 10 seconds occurs until normal service is restored.
Now I know this is due to me populating 4 combo box from the files below (See stats):-
towns 40,166 lines
cities 664 lines
counties 49 lines
Phonecodes 676 lines
I wait until the form is show before starting off 4 background workers to ease the load and allow the main GUI form thread to be active.
Form shown event
Code:
Me.BackgroundWorker1.RunWorkerAsync()
Me.BackgroundWorker2.RunWorkerAsync()
Me.BackgroundWorker3.RunWorkerAsync()
Me.BackgroundWorker4.RunWorkerAsync()
Each background work reads the files into a string array (see below)
BackgroundWorker1_DoWork
Code:
countyLookup = IO.File.ReadAllLines(My.Application.Info.DirectoryPath + "\lookupdata\counties.txt")
Finally when the background process is finished populate the combobox.
BackgroundWorker1_RunWorkerCompleted
Code:
Me.cboCounty.BeginUpdate()
Me.cboCounty.Items.AddRange(countyLookup)
Me.cboCounty.EndUpdate()
I was puzzled that the glitch appears even before the form is shown.
Does anyone have any ideas of how I can resolve the glitch?
The application backend is a MS database (*.accdb) and wondering if to make tables instead of reading the text files.
However tables containing just one field do seem pointless and note the address/phone code data is NOT RELATED.
Thanks
Rob
PS: Now I format my posts so they can be read easier
