Click here to Skip to main content
15,921,905 members
Home / Discussions / C#
   

C#

 
QuestionGet one type of elements from dictionary Pin
Mc_Topaz27-Jun-11 3:01
Mc_Topaz27-Jun-11 3:01 
AnswerRe: Get one type of elements from dictionary Pin
musefan27-Jun-11 3:08
musefan27-Jun-11 3:08 
GeneralRe: Get one type of elements from dictionary Pin
Mc_Topaz27-Jun-11 3:16
Mc_Topaz27-Jun-11 3:16 
GeneralRe: Get one type of elements from dictionary Pin
BobJanova27-Jun-11 3:56
BobJanova27-Jun-11 3:56 
AnswerRe: Get one type of elements from dictionary Pin
Keith Barrow27-Jun-11 3:28
professionalKeith Barrow27-Jun-11 3:28 
GeneralRe: Get one type of elements from dictionary Pin
David198727-Jun-11 4:01
David198727-Jun-11 4:01 
AnswerRe: Get one type of elements from dictionary Pin
Ian Shlasko27-Jun-11 9:43
Ian Shlasko27-Jun-11 9:43 
AnswerRe: Get one type of elements from dictionary Pin
SledgeHammer0127-Jun-11 11:19
SledgeHammer0127-Jun-11 11:19 
GeneralRe: Get one type of elements from dictionary Pin
PIEBALDconsult27-Jun-11 14:39
mvePIEBALDconsult27-Jun-11 14:39 
GeneralRe: Get one type of elements from dictionary Pin
Mycroft Holmes27-Jun-11 19:40
professionalMycroft Holmes27-Jun-11 19:40 
GeneralRe: Get one type of elements from dictionary Pin
SledgeHammer0127-Jun-11 19:44
SledgeHammer0127-Jun-11 19:44 
GeneralRe: Get one type of elements from dictionary Pin
Mycroft Holmes27-Jun-11 19:49
professionalMycroft Holmes27-Jun-11 19:49 
QuestionNavigating between forms Pin
Berlus26-Jun-11 1:19
Berlus26-Jun-11 1:19 
AnswerRe: Navigating between forms Pin
Mycroft Holmes26-Jun-11 1:59
professionalMycroft Holmes26-Jun-11 1:59 
AnswerRe: Navigating between forms Pin
Not Active27-Jun-11 2:29
mentorNot Active27-Jun-11 2:29 
QuestionCustom control sometimes doesn't paint/refresh the button on it Pin
teknolog12325-Jun-11 23:13
teknolog12325-Jun-11 23:13 
AnswerRe: Custom control sometimes doesn't paint/refresh the button on it Pin
Dave Kreskowiak27-Jun-11 9:22
mveDave Kreskowiak27-Jun-11 9:22 
QuestionStarting intrupped thread again.. Pin
shivamkalra25-Jun-11 19:06
shivamkalra25-Jun-11 19:06 
Hi,

I need to design a program should be able to update certain textbox for each event inside the GUI and after every 10 seconds of most recent event, text tox should be back to original value..Let say
<br />
Event one occurs --> text box updated --> after 10 seconds --> text box back to normal


This is the case in perfect world, but it might be possible that someone create another GUI event during this period of 10 seconds..

Event one occurs --> text box updated --> after 8 seconds --> event two occurs --> GUI updated --> after 2 seconds the other thread (10 seconds completed for first event), text box back to normal.

So in this case, for second event, the textbox get back to original value in just 2 seconds. I know I could use thread intrupt to cancel the other thread. But my question is, it the best way of doing it?? And what is there any other way to starting intrupped thread again, without making a new thread? Will thread intrupt make sure everything will go perfect?? Would you suggest some more efficient way? I may be misunderstanding about threading here, please forgive that. Any suggestions, links or comments will be appreciated.

PS
So far my code is like this..

Thread t = new Thread(keep_run);

public void update()
{
    t.Interrupt();
    if (MessageLbl.InvokeRequired)
    {
        MessageLbl.Invoke(new setText(() => MessageLbl.Text = "User settings have been updated."));
    }
    else
    {
        MessageLbl.Text = "User settings have been updated.";
    }

    t = new Thread(keep_run);
    t.Start();
}

private void keep_run()
{
    try
    {
        Thread.Sleep(10000);
        MessageLbl.Invoke(new setText(() => MessageLbl.Text = "Welcome to MAT Downloader"));
    }
    catch { MessageBox.Show("Interrupted"); }
}
}


If you find any other problems with the code then do mention them.

Thanks
Regards,
Shivam Kalra Smile | :)
AnswerRe: Starting intrupped thread again.. Pin
MicroVirus26-Jun-11 0:44
MicroVirus26-Jun-11 0:44 
QuestionNamedPipeClientStream.Connect(int) doesn't throw Exception if Form is closed. [fixed, workaround] Pin
Xmen Real 25-Jun-11 17:59
professional Xmen Real 25-Jun-11 17:59 
QuestionKnow when form loses focus? Pin
Matt U.25-Jun-11 13:30
Matt U.25-Jun-11 13:30 
AnswerRe: Know when form loses focus? Pin
Dr.Walt Fair, PE25-Jun-11 16:49
professionalDr.Walt Fair, PE25-Jun-11 16:49 
GeneralRe: Know when form loses focus? Pin
Matt U.26-Jun-11 2:47
Matt U.26-Jun-11 2:47 
QuestionPopulate Listview using LINQ Pin
klaydze24-Jun-11 15:22
klaydze24-Jun-11 15:22 
QuestionRe: Populate Listview using LINQ Pin
Mario Majčica24-Jun-11 21:20
professionalMario Majčica24-Jun-11 21:20 

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.