Click here to Skip to main content
15,897,273 members
Home / Discussions / C#
   

C#

 
QuestionLastIndexOf("") in C# Pin
jayarajmrj8-Aug-07 20:05
jayarajmrj8-Aug-07 20:05 
AnswerRe: LastIndexOf("") in C# Pin
hamid_m8-Aug-07 20:19
hamid_m8-Aug-07 20:19 
AnswerRe: LastIndexOf("") in C# Pin
Vikram A Punathambekar8-Aug-07 21:45
Vikram A Punathambekar8-Aug-07 21:45 
AnswerRe: LastIndexOf("") in C# Pin
Luc Pattyn9-Aug-07 0:57
sitebuilderLuc Pattyn9-Aug-07 0:57 
QuestionWindows Form Pin
sangramkp8-Aug-07 19:37
sangramkp8-Aug-07 19:37 
AnswerRe: Windows Form Pin
Christian Graus8-Aug-07 19:41
protectorChristian Graus8-Aug-07 19:41 
QuestionSwitching between two threads Pin
praveen pandey8-Aug-07 18:48
praveen pandey8-Aug-07 18:48 
AnswerRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 19:41
Leslie Sanford8-Aug-07 19:41 
praveen pandey wrote:
I am having two threads first one is main thread and second one a thread in which a function is called.In second thread,while loop is there.When one iteration is completed in loop i have to switch to main thread and call a function and again come to second thread and repeat the process.


You have the threads signal each other when control should pass from one to the other. While one thread is doing work, the other waits. When the work is finished, the working thread signals the waiting thread that it's done. It then begins waiting while the other thread does its work.

Typically, a worker thread looks something like this:

private void ThreadMethod()
{
    lock(lockObject)
    { 
        while(someConditionIsTrue)
        {
            Monitor.Wait(lockObject);
 
            // Do some work...
        }
    }
}


From another thread, you have to pulse the lock to get the worker thread running:

lock(lockObject)
{
    Monitor.Pulse(lockObject);
}


However, since one of these threads is the main thread, you probably don't want it blocking while the other thread is doing work. This could tie up your UI. So we need more information about the kind of application you're writing. Is it a console app? A Window Forms app?
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 19:55
praveen pandey8-Aug-07 19:55 
GeneralRe: Switching between two threads Pin
Leslie Sanford8-Aug-07 21:41
Leslie Sanford8-Aug-07 21:41 
GeneralRe: Switching between two threads Pin
praveen pandey8-Aug-07 23:51
praveen pandey8-Aug-07 23:51 
QuestionBypass character in textbox Pin
Edwin Syarief8-Aug-07 17:46
Edwin Syarief8-Aug-07 17:46 
AnswerRe: Bypass character in textbox Pin
-BoBo8-Aug-07 17:52
-BoBo8-Aug-07 17:52 
GeneralRe: Bypass character in textbox [modified] Pin
Edwin Syarief8-Aug-07 17:54
Edwin Syarief8-Aug-07 17:54 
GeneralRe: Bypass character in textbox Pin
Christian Graus8-Aug-07 18:35
protectorChristian Graus8-Aug-07 18:35 
AnswerRe: Bypass character in textbox Pin
Nouman Bhatti8-Aug-07 19:43
Nouman Bhatti8-Aug-07 19:43 
AnswerRe: Bypass character in textbox Pin
Edwin Syarief8-Aug-07 21:27
Edwin Syarief8-Aug-07 21:27 
QuestionUpdating DataSet Pin
-BoBo8-Aug-07 17:29
-BoBo8-Aug-07 17:29 
AnswerRe: Updating DataSet Pin
hamid_m8-Aug-07 19:23
hamid_m8-Aug-07 19:23 
Questiondouble buffering for flickering problem Pin
cyn88-Aug-07 17:10
cyn88-Aug-07 17:10 
AnswerRe: double buffering for flickering problem Pin
Martin#8-Aug-07 20:26
Martin#8-Aug-07 20:26 
AnswerRe: double buffering for flickering problem Pin
Luc Pattyn9-Aug-07 1:04
sitebuilderLuc Pattyn9-Aug-07 1:04 
QuestionFormula - How many address in a range Pin
StevenWalsh8-Aug-07 17:01
StevenWalsh8-Aug-07 17:01 
AnswerRe: Formula - How many address in a range Pin
Christian Graus8-Aug-07 17:29
protectorChristian Graus8-Aug-07 17:29 
GeneralRe: Formula - How many address in a range Pin
StevenWalsh8-Aug-07 18:05
StevenWalsh8-Aug-07 18:05 

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.