Did you have a look at the ProgressBar object in the ControlsEx library ?
Only memory limit. Can be very large.PS How many values can an array is hold? Is there a limit or is it purely memory dependant?
Kolbe is correct. You must do the work in the thread so that the main program is free to process messages and keep the GUI alive. You won't be able to display progress if the main thread is wrapped up doing work as it will never get the chance to process messages to draw the GUI.
There's too much of your sample code to delve into to find out what you are doing but looking at DisplayNotice
1) You must not try to update GUI elements from a thread. You need to use a thread event as events run on the main form thread which is the only thread allowed to update the GUI. To use thread events in a FormEx you need to invoke FormEx.EnableThreading.
2) DoEvents is of no use in a thread as DoEvents processes any windows messages waiting in the thread's message queue and only the main form thread has a message queue.
It's unlikely to be directly to do with threading unless it is something to do with the Thread object itself. The code ought to run identically whether threaded or not as long as it doesn't access user interface elements which is a no-no for a thread. This is a .NET requirement and not a Basic4ppc limitation. If you don't sort it then post a runnable version that errors and I'll take a look.IWhere am I going so wrong
The problem, believe it or not, is to do with AutoScaling! The New code on a Command object looks for the thread AutoScaling data that is not present on a Threading library thread, it is only present on the main forms' thread. For the time being keep the New invokes outside the thread and just do the call to perform the SQL query and any subsequent (non-GUI) processing in the Thread.
I'll ponder this a bit more tomorrow - maybe I need to replicate the thread data but I'll see.
Genius, sheer genius!How do you work these things out?
An error occurred on sub search.updatetable.
Line number: 121
SQLCommand.ExecuteTable( "TblFiles" , 0 )
Error description:
Controls created on one thread cannot be parented to a control on a different thread.
Continue?
I would guess that too. Every time you do Thread.Start you create a new thread which is a different thread to the previous one on which some components of the Table were created by ExecuteTable.At a guess I need to dispose of the table (if present) and then create a new one each time I want to use the ExecuteTable command. Is this the correct way?
It's probably not complaining about the Table but about some sub-control of the Table that is recreated when you invoke ExecuteTable.What troubles me is the fact that I'm not actually creating a new control with the ExecuteTable command, according to the help file it just empties the existing table before loading new values and so should I be getting this message?
However there is a deeper problem here do do with acessing GUI controls on a different thread to the main thread. A Table is a GUI control and should not really be accessed from a thread. You may get away with it on the desktop but a device will probably complain as it has strict checks for cross-thread access that the desktop doesn't have. You should really be using ExecuteReader in a thread but try Dispose and New and see if it works for you. Does your SQL query really take that long to run that it needs to be on a thread?
The GUI controls, including Forms, belong to the thread that created them and no other thread should touch them. Whether a Form is shown or not doesn't matter, who it belongs to does. An application can have many Forms but they all (in Basic4ppc) belong to the one main thread that starts on the first Form.Show. All events in Basic4ppc run on the main thread for this reason so you use thread events to run code that wants to update the GUI because that code will run on the correct thread. Your thread is supended until the main thread has run the event code then the thread resumes so it looks like a normal Sub call but takes a lot longer to execute.thought that I was OK to update the content of a table and some ComboBoxes since the Form these reside on is not shown. I wait until the Thread is finished before attempting to show the Form.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?