Ok. I don't know if scrapping the code is NECESSARY, but I would. But you won't unless you know why you should do so, so:
1.) Have a look at the
"With... End With" Statement. This will neaten and speed up your code.
2.) You can't access UI controls from a background thread. Instead, we use DELEGATES.
Here's a tutorial on how to use them. Basically, you need to call a delegate like a function, and then in that function you switch to the UI thread using control.InvokeRequired() before accessing the UI controls.
3.) Use Camel Case, and descriptive variable, class and function names. Don't be afraid to use longs names - this will make your code much more readable. Much easier to understand. NEVER use variable names like "s".
4.) Last, there are much better ways to access the images in My.resources then all those for if... else evaluators. For instance, you could convert the string representations of the number from the database ( Ie: Convert.ToInt32(luckyNumArray.Chars(0)) ), and then access the images via their index number after adding them to an ImageList control (ImageList1.Images(index_number)). This would eliminate most of that clutter.
And there are more things then this... I'm just making a few suggestions here.
Good luck.
- Pete