Click here to Skip to main content
15,919,479 members
Home / Discussions / C#
   

C#

 
AnswerRe: Reading Very Large Text File ... Pin
Ennis Ray Lynch, Jr.18-Oct-07 10:01
Ennis Ray Lynch, Jr.18-Oct-07 10:01 
QuestionoleDB, Odbc, DataBase Pin
half-life18-Oct-07 3:37
half-life18-Oct-07 3:37 
AnswerRe: oleDB, Odbc, DataBase Pin
Abhijit Jana18-Oct-07 3:48
professionalAbhijit Jana18-Oct-07 3:48 
GeneralRe: oleDB, Odbc, DataBase Pin
half-life18-Oct-07 3:55
half-life18-Oct-07 3:55 
GeneralRe: oleDB, Odbc, DataBase Pin
Abhijit Jana18-Oct-07 4:09
professionalAbhijit Jana18-Oct-07 4:09 
AnswerRe: oleDB, Odbc, DataBase Pin
J4amieC18-Oct-07 3:54
J4amieC18-Oct-07 3:54 
JokeRe: oleDB, Odbc, DataBase Pin
Abhijit Jana18-Oct-07 4:10
professionalAbhijit Jana18-Oct-07 4:10 
QuestionThreading Problem- a thread that calls two functions Pin
gizmokaka18-Oct-07 3:33
gizmokaka18-Oct-07 3:33 
I created a thread to which I passed two ThreadStart delegates to execute for me in the following manner.

ThreadStart myWorkerThread = (ThreadStart)Delegate.Combine(new ThreadStart(addListItemsToDisplay), new ThreadStart(checkProblematicValves));
                Thread listThread = new Thread(myWorkerThread);
                listThread.Start();


the delegate are:
public delegate void addListItemsHandler();
public delegate void checkProblematicValvesHendler();


the problem I encounter is that when executing the second function, it runs into an endless loop, only
of a reason related to the fact a different thread is running it, because if I run it from the main
thread, this doesn't occure, it simply leaves the function.

the function is:

private void checkProblematicValves()
        {
            foreach (long key in messageArr.Keys)
            {
                if (messageArr[key] != null)
                {
                    //foreach (object message in messageArr[key])
                    for (int j = 0; j < messageArr[key].Count - 1; j++ )
                    {
                        if (/*message*/messageArr[key][j] is Clusters.CSensorStatus)
                        {
                            if ((messageArr[key][j] as Clusters.CSensorStatus).valveAngDeg > 0)
                            {
                                string myKey = LongToHex(key);
                                int index = valveCheckedListBox.Items.IndexOf(myKey);
                                if (valveCheckedListBox.InvokeRequired)
                                {
                                    checkProblematicValvesHendler d = new checkProblematicValvesHendler(checkProblematicValves);
                                    valveCheckedListBox.Invoke(d);
                                }
                                valveCheckedListBox.SetItemChecked(index, true);
                            }
                        }
                    }
                    Thread.Sleep(50);
                }
            }
        }
//From here it returns to the start of the function for NO apparent reason.

Please help me!!!

thanks in advanced.
AnswerRe: Threading Problem- a thread that calls two functions Pin
Luc Pattyn18-Oct-07 4:15
sitebuilderLuc Pattyn18-Oct-07 4:15 
GeneralRe: Threading Problem- a thread that calls two functions Pin
gizmokaka18-Oct-07 5:11
gizmokaka18-Oct-07 5:11 
GeneralRe: Threading Problem- a thread that calls two functions Pin
Luc Pattyn18-Oct-07 5:27
sitebuilderLuc Pattyn18-Oct-07 5:27 
GeneralRe: Threading Problem- a thread that calls two functions Pin
gizmokaka18-Oct-07 5:48
gizmokaka18-Oct-07 5:48 
GeneralRe: Threading Problem- a thread that calls two functions Pin
Luc Pattyn18-Oct-07 6:58
sitebuilderLuc Pattyn18-Oct-07 6:58 
QuestionAny idea about how to work with IM? Pin
baburman18-Oct-07 3:33
baburman18-Oct-07 3:33 
AnswerRe: Any idea about how to work with IM? Pin
Abhijit Jana18-Oct-07 3:51
professionalAbhijit Jana18-Oct-07 3:51 
GeneralRe: Any idea about how to work with IM? Pin
baburman18-Oct-07 6:36
baburman18-Oct-07 6:36 
AnswerRe: Any idea about how to work with IM? Pin
User 665818-Oct-07 3:56
User 665818-Oct-07 3:56 
GeneralRe: Any idea about how to work with IM? Pin
Abhijit Jana18-Oct-07 4:51
professionalAbhijit Jana18-Oct-07 4:51 
Questiongloabal variable Pin
kabutar18-Oct-07 3:18
kabutar18-Oct-07 3:18 
AnswerRe: gloabal variable Pin
Abhijit Jana18-Oct-07 3:43
professionalAbhijit Jana18-Oct-07 3:43 
GeneralRe: gloabal variable Pin
kabutar18-Oct-07 3:51
kabutar18-Oct-07 3:51 
GeneralRe: gloabal variable Pin
rajansethi18-Oct-07 4:52
rajansethi18-Oct-07 4:52 
AnswerRe: gloabal variable Pin
Luc Pattyn18-Oct-07 4:02
sitebuilderLuc Pattyn18-Oct-07 4:02 
GeneralCustomization of FxCop Pin
bhaskarsri18-Oct-07 2:26
bhaskarsri18-Oct-07 2:26 
GeneralRe: Customization of FxCop Pin
Scott Dorman18-Oct-07 4:08
professionalScott Dorman18-Oct-07 4:08 

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.