Click here to Skip to main content
15,881,828 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to copy a picture??? Pin
CrazyDragon638420-Jan-06 23:23
CrazyDragon638420-Jan-06 23:23 
GeneralRe: How to copy a picture??? Pin
CodyGen21-Jan-06 3:45
CodyGen21-Jan-06 3:45 
QuestionDataGridViewColumn DefaultCellStyle help Pin
Kasdoffe20-Jan-06 7:59
Kasdoffe20-Jan-06 7:59 
QuestionCalling Visual Basic .net class object in C# Pin
idreesbadshah20-Jan-06 7:33
idreesbadshah20-Jan-06 7:33 
AnswerRe: Calling Visual Basic .net class object in C# Pin
Dave Kreskowiak20-Jan-06 7:39
mveDave Kreskowiak20-Jan-06 7:39 
Questionwhy can't i start/stop separate threads inside of same block? Pin
WetRivrRat20-Jan-06 5:47
WetRivrRat20-Jan-06 5:47 
AnswerRe: why can't i start/stop separate threads inside of same block? Pin
Le centriste20-Jan-06 6:03
Le centriste20-Jan-06 6:03 
AnswerRe: why can't i start/stop separate threads inside of same block? Pin
Dave Kreskowiak20-Jan-06 6:25
mveDave Kreskowiak20-Jan-06 6:25 
private void PopComputerList()
{
    CallCompList = new MethodInvoker(CompList);
    de = new DirectoryEntry("LDAP://~.com");
    ds = new DirectorySearcher(de);
    ds.Filter = ("(~)");
    this.BeginInvoke(CallCompList);
}
private void PopEmpList()
{
    CallEmpList = new MethodInvoker(EmpList);
    de = new DirectoryEntry("LDAP://~.com");
    ds = new DirectorySearcher(de);
    ds.Filter = ("(~)");
    this.BeginInvoke(CallEmpList);
}

Look what you're doing here with the de and ds variables. You're using a class scoped de and ds variables. DON'T! Each thread should create and use it's own set of Directory objects scoped within the methods themselves.

What's happening is that when you launch your first thread, it sets up the de and ds variables to perform a search. While that setup and search is taking place, you launch another thread that, low and behold, reassigns new DirectorySearcher and DirectoryEntry objects to the very same de and ds variables you just setup in your previous thread. Global variables - bad idea...


RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome


-- modified at 12:26 Friday 20th January, 2006
GeneralRe: why can't i start/stop separate threads inside of same block? Pin
WetRivrRat20-Jan-06 7:50
WetRivrRat20-Jan-06 7:50 
QuestionError handling - which is preferrable? Pin
Judah Gabriel Himango20-Jan-06 5:25
sponsorJudah Gabriel Himango20-Jan-06 5:25 
AnswerRe: Error handling - which is preferrable? Pin
Colin Angus Mackay20-Jan-06 5:34
Colin Angus Mackay20-Jan-06 5:34 
GeneralRe: Error handling - which is preferrable? Pin
Werdna20-Jan-06 6:14
Werdna20-Jan-06 6:14 
GeneralRe: Error handling - which is preferrable? Pin
Judah Gabriel Himango20-Jan-06 9:56
sponsorJudah Gabriel Himango20-Jan-06 9:56 
QuestiondataGrid & first row selection Pin
moonangel_bio20-Jan-06 5:00
moonangel_bio20-Jan-06 5:00 
AnswerRe: dataGrid & first row selection Pin
CodyGen20-Jan-06 5:42
CodyGen20-Jan-06 5:42 
AnswerRe: dataGrid & first row selection Pin
Drew McGhie20-Jan-06 9:22
Drew McGhie20-Jan-06 9:22 
GeneralRe: dataGrid & first row selection Pin
moonangel_bio21-Jan-06 1:34
moonangel_bio21-Jan-06 1:34 
QuestionClearing the DataTable Pin
dvsr20-Jan-06 4:21
dvsr20-Jan-06 4:21 
QuestionPower Point from C# code Pin
Bested20-Jan-06 2:57
Bested20-Jan-06 2:57 
QuestionHow to use Bass.Net.dll Pin
Divyang Mithaiwala20-Jan-06 2:41
Divyang Mithaiwala20-Jan-06 2:41 
AnswerRe: How to use Bass.Net.dll Pin
Colin Angus Mackay20-Jan-06 5:36
Colin Angus Mackay20-Jan-06 5:36 
GeneralRe: How to use Bass.Net.dll Pin
Divyang Mithaiwala20-Jan-06 6:25
Divyang Mithaiwala20-Jan-06 6:25 
GeneralRe: How to use Bass.Net.dll Pin
Dave Kreskowiak20-Jan-06 7:01
mveDave Kreskowiak20-Jan-06 7:01 
Questiondatagrid out of bound error,Plz help Pin
rudra08320-Jan-06 1:47
rudra08320-Jan-06 1:47 
QuestionDatagrid Selection ,Giving out of bound index error Pin
rudra08320-Jan-06 1:45
rudra08320-Jan-06 1:45 

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.