Click here to Skip to main content
15,892,005 members
Home / Discussions / C#
   

C#

 
GeneralRe: DataGridView with MySQL IndexOutOfRange error Pin
memorexr4-Oct-10 9:43
memorexr4-Oct-10 9:43 
GeneralRe: DataGridView with MySQL IndexOutOfRange error Pin
Luc Pattyn4-Oct-10 10:07
sitebuilderLuc Pattyn4-Oct-10 10:07 
AnswerRe: DataGridView with MySQL IndexOutOfRange error Pin
Abhinav S2-Oct-10 5:29
Abhinav S2-Oct-10 5:29 
GeneralRe: DataGridView with MySQL IndexOutOfRange error Pin
Luc Pattyn2-Oct-10 5:33
sitebuilderLuc Pattyn2-Oct-10 5:33 
QuestionRunning a method on a seperate thread Pin
teknolog1232-Oct-10 3:26
teknolog1232-Oct-10 3:26 
AnswerRe: Running a method on a seperate thread Pin
Henry Minute2-Oct-10 3:32
Henry Minute2-Oct-10 3:32 
GeneralRe: Running a method on a seperate thread Pin
teknolog1232-Oct-10 3:44
teknolog1232-Oct-10 3:44 
AnswerRe: Running a method on a seperate thread [modified] Pin
Luc Pattyn2-Oct-10 3:51
sitebuilderLuc Pattyn2-Oct-10 3:51 
A lot of information is missing to understand what is going on here, such as:
- what timer you use
- what dlgUpdate might be
- what exactly is happening in doUpdate().

If your timer is a System.Windows.Forms.Timer (as your interval comment may suggest), then you should know it always "ticks" on the main thread, so the InvokeRequired line doesn't make sense, and the GUI behavior will be hampered by whatever doUpdate() actually does (such as waiting for a DB response).

If you were to switch to another kind of timer, it would not make sense to have its tick handler do an Invoke the way you did it, as that too would cause everything to run on the main thread. What you probably should do is:
- start a thread that loops a combination of doUpdate and a Thread.Sleep
- have doUpdate gather information and not touch the GUI
- then Invoke a method to update the GUI (that must run on the main thread, see here[^].

[ADDED]
You should have a look at BackgroundWorker, as that is pretty much tailored to what you probably want: put the loop (fetchData+sleep) in DoWork, and use ReportProgress to update the GUI.
[/ADDED]

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.


GeneralRe: Running a method on a seperate thread Pin
teknolog1232-Oct-10 13:37
teknolog1232-Oct-10 13:37 
AnswerRe: Running a method on a seperate thread Pin
Luc Pattyn2-Oct-10 14:17
sitebuilderLuc Pattyn2-Oct-10 14:17 
GeneralRe: Running a method on a seperate thread Pin
teknolog1233-Oct-10 5:11
teknolog1233-Oct-10 5:11 
GeneralRe: Running a method on a seperate thread Pin
Luc Pattyn3-Oct-10 5:18
sitebuilderLuc Pattyn3-Oct-10 5:18 
QuestionVisual diff of 2 DataTables Pin
Aaron D Anderson1-Oct-10 20:47
Aaron D Anderson1-Oct-10 20:47 
AnswerRe: Visual diff of 2 DataTables Pin
Luc Pattyn2-Oct-10 4:10
sitebuilderLuc Pattyn2-Oct-10 4:10 
AnswerRe: Visual diff of 2 DataTables Pin
PIEBALDconsult2-Oct-10 15:48
mvePIEBALDconsult2-Oct-10 15:48 
QuestionDebug Break Pin
Richard Andrew x641-Oct-10 7:51
professionalRichard Andrew x641-Oct-10 7:51 
AnswerRe: Debug Break Pin
OriginalGriff1-Oct-10 8:16
mveOriginalGriff1-Oct-10 8:16 
GeneralRe: Debug Break Pin
Richard Andrew x641-Oct-10 8:22
professionalRichard Andrew x641-Oct-10 8:22 
GeneralRe: Debug Break Pin
OriginalGriff1-Oct-10 8:30
mveOriginalGriff1-Oct-10 8:30 
AnswerRe: Debug Break Pin
Abhinav S1-Oct-10 18:08
Abhinav S1-Oct-10 18:08 
QuestionDecoding non-ascii characters Pin
Chriso821-Oct-10 1:58
Chriso821-Oct-10 1:58 
AnswerRe: Decoding non-ascii characters Pin
Luc Pattyn1-Oct-10 2:10
sitebuilderLuc Pattyn1-Oct-10 2:10 
AnswerRe: Decoding non-ascii characters Pin
Chriso821-Oct-10 3:51
Chriso821-Oct-10 3:51 
GeneralRe: Decoding non-ascii characters Pin
Luc Pattyn1-Oct-10 4:47
sitebuilderLuc Pattyn1-Oct-10 4:47 
Questionhow to program cash drawer? Pin
Syed Shahid Hussain1-Oct-10 0:26
Syed Shahid Hussain1-Oct-10 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.