Click here to Skip to main content
15,388,820 members
Home / Discussions / C#
   

C#

 
GeneralRe: What's the difference between Binary and Text file? Pin
Heath Stewart20-Jan-06 15:18
protectorHeath Stewart20-Jan-06 15:18 
GeneralRe: What's the difference between Binary and Text file? Pin
pmasknguyen21-Jan-06 6:29
Memberpmasknguyen21-Jan-06 6:29 
GeneralRe: What's the difference between Binary and Text file? Pin
Dave Kreskowiak21-Jan-06 8:46
mveDave Kreskowiak21-Jan-06 8:46 
Questiondisplay a file to the browser using stream Pin
CodyGen20-Jan-06 11:27
MemberCodyGen20-Jan-06 11:27 
AnswerRe: display a file to the browser using stream Pin
Heath Stewart20-Jan-06 12:12
protectorHeath Stewart20-Jan-06 12:12 
GeneralRe: display a file to the browser using stream Pin
CodyGen20-Jan-06 12:49
MemberCodyGen20-Jan-06 12:49 
GeneralRe: display a file to the browser using stream Pin
Heath Stewart20-Jan-06 15:12
protectorHeath Stewart20-Jan-06 15:12 
QuestionBindingNavigator's AddNew vs. AutoIncrement DB fields Pin
mrlucmorin20-Jan-06 9:18
Membermrlucmorin20-Jan-06 9:18 
AnswerRe: BindingNavigator's AddNew vs. AutoIncrement DB fields Pin
Guffa20-Jan-06 9:57
MemberGuffa20-Jan-06 9:57 
GeneralRe: BindingNavigator's AddNew vs. AutoIncrement DB fields Pin
mrlucmorin20-Jan-06 10:45
Membermrlucmorin20-Jan-06 10:45 
GeneralRe: BindingNavigator's AddNew vs. AutoIncrement DB fields Pin
Dave Kreskowiak20-Jan-06 11:28
mveDave Kreskowiak20-Jan-06 11:28 
QuestionHow do I create dynamic content (has to be easy!) Pin
Roger Jane20-Jan-06 8:33
MemberRoger Jane20-Jan-06 8:33 
AnswerRe: How do I create dynamic content (has to be easy!) Pin
Guffa20-Jan-06 9:07
MemberGuffa20-Jan-06 9:07 
GeneralRe: How do I create dynamic content (has to be easy!) Pin
Roger Jane20-Jan-06 22:39
MemberRoger Jane20-Jan-06 22:39 
QuestionHow to copy a picture??? Pin
CrazyDragon638420-Jan-06 8:26
MemberCrazyDragon638420-Jan-06 8:26 
AnswerRe: How to copy a picture??? Pin
Wjousts20-Jan-06 9:26
MemberWjousts20-Jan-06 9:26 
AnswerRe: How to copy a picture??? Pin
CodyGen20-Jan-06 9:44
MemberCodyGen20-Jan-06 9:44 
AnswerRe: How to copy a picture??? Pin
CrazyDragon638420-Jan-06 23:23
MemberCrazyDragon638420-Jan-06 23:23 
GeneralRe: How to copy a picture??? Pin
CodyGen21-Jan-06 3:45
MemberCodyGen21-Jan-06 3:45 
QuestionDataGridViewColumn DefaultCellStyle help Pin
Kasdoffe20-Jan-06 7:59
MemberKasdoffe20-Jan-06 7:59 
QuestionCalling Visual Basic .net class object in C# Pin
idreesbadshah20-Jan-06 7:33
Memberidreesbadshah20-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
MemberWetRivrRat20-Jan-06 5:47 
AnswerRe: why can't i start/stop separate threads inside of same block? Pin
Le centriste20-Jan-06 6:03
MemberLe 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

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.