Click here to Skip to main content
15,918,041 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exporting Datagridview Headers to excel Pin
Mycroft Holmes19-Apr-10 22:40
professionalMycroft Holmes19-Apr-10 22:40 
RantRe: Exporting Datagridview Headers to excel Pin
ZiggyNet20-Apr-10 3:46
ZiggyNet20-Apr-10 3:46 
GeneralRe: Exporting Datagridview Headers to excel Pin
Mycroft Holmes20-Apr-10 12:25
professionalMycroft Holmes20-Apr-10 12:25 
QuestionWhy the form be changed? [modified][Solved] Pin
yu-jian19-Apr-10 20:21
yu-jian19-Apr-10 20:21 
QuestionRe: Why the form be changed? Pin
Michel Godfroid19-Apr-10 20:37
Michel Godfroid19-Apr-10 20:37 
AnswerRe: Why the form be changed? Pin
Mycroft Holmes19-Apr-10 22:42
professionalMycroft Holmes19-Apr-10 22:42 
GeneralRe: Why the form be changed? Pin
yu-jian20-Apr-10 6:58
yu-jian20-Apr-10 6:58 
QuestionBlock a method execution Pin
Hum Dum19-Apr-10 18:59
Hum Dum19-Apr-10 18:59 
There is Class A, and other classes B, C, D for ex.

Class A contain a Method say

private void MessageRecvd(string Msg)
{
//.....code
}


Now i am calling this method from B, C, D when i receive some data. If data is coming at different time , then no problem. But when all B, C, D receives data at same time, they call MessageRecvd at same time. And this leads to corrupted/loss data.

Is there a way to make the calling class to wait until the current method execution completes.

I tries like
private void MessageRecvd(string Msg)
{
    lock(this)
    {
       //.....code
    }
}



Also Like
private Object lockMsgRecv = new Object();
private void MessageRecvd(string Msg)
{
    lock(lockMsgRecv )
    {
       //.....code
    }
}


But unable to get the desired result.
Any help/Guidance appreciated.
QuestionRe: Block a method execution Pin
Michel Godfroid19-Apr-10 19:41
Michel Godfroid19-Apr-10 19:41 
AnswerRe: Block a method execution Pin
Hum Dum19-Apr-10 20:00
Hum Dum19-Apr-10 20:00 
QuestionRe: Block a method execution Pin
Michel Godfroid19-Apr-10 20:23
Michel Godfroid19-Apr-10 20:23 
GeneralRe: Block a method execution Pin
Luc Pattyn20-Apr-10 1:11
sitebuilderLuc Pattyn20-Apr-10 1:11 
GeneralRe: Block a method execution Pin
Hum Dum20-Apr-10 1:45
Hum Dum20-Apr-10 1:45 
GeneralRe: Block a method execution Pin
Luc Pattyn20-Apr-10 1:56
sitebuilderLuc Pattyn20-Apr-10 1:56 
AnswerRe: Block a method execution Pin
Calla19-Apr-10 20:08
Calla19-Apr-10 20:08 
GeneralRe: Block a method execution Pin
Hum Dum19-Apr-10 20:18
Hum Dum19-Apr-10 20:18 
GeneralRe: Block a method execution Pin
Calla19-Apr-10 20:39
Calla19-Apr-10 20:39 
GeneralRe: Block a method execution Pin
Michel Godfroid19-Apr-10 21:12
Michel Godfroid19-Apr-10 21:12 
GeneralRe: Block a method execution Pin
Calla19-Apr-10 21:18
Calla19-Apr-10 21:18 
JokeRe: Block a method execution Pin
Michel Godfroid19-Apr-10 21:22
Michel Godfroid19-Apr-10 21:22 
GeneralRe: Block a method execution Pin
Mycroft Holmes19-Apr-10 22:47
professionalMycroft Holmes19-Apr-10 22:47 
GeneralRe: Block a method execution Pin
Michel Godfroid19-Apr-10 23:14
Michel Godfroid19-Apr-10 23:14 
GeneralRe: Block a method execution Pin
Hum Dum19-Apr-10 21:28
Hum Dum19-Apr-10 21:28 
GeneralRe: Block a method execution Pin
Hum Dum20-Apr-10 1:53
Hum Dum20-Apr-10 1:53 
GeneralRe: Block a method execution Pin
Michel Godfroid20-Apr-10 4:35
Michel Godfroid20-Apr-10 4:35 

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.