Click here to Skip to main content
15,893,381 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Populate Listview using LINQ Pin
#realJSOP25-Jun-11 0:30
mve#realJSOP25-Jun-11 0:30 
GeneralRe: Populate Listview using LINQ Pin
Mycroft Holmes25-Jun-11 2:39
professionalMycroft Holmes25-Jun-11 2:39 
GeneralRe: Populate Listview using LINQ Pin
Dan Mos25-Jun-11 3:26
Dan Mos25-Jun-11 3:26 
GeneralRe: Populate Listview using LINQ Pin
Not Active27-Jun-11 2:27
mentorNot Active27-Jun-11 2:27 
AnswerRe: Populate Listview using LINQ Pin
klaydze25-Jun-11 3:25
klaydze25-Jun-11 3:25 
QuestionTask queues to execute a task one by one in file downloader program. [modified] Pin
shivamkalra24-Jun-11 12:37
shivamkalra24-Jun-11 12:37 
AnswerRe: Task queues to execute a task one by one in file downloader program. Pin
Richard MacCutchan24-Jun-11 23:01
mveRichard MacCutchan24-Jun-11 23:01 
QuestionNot Lost focus of form. Pin
Anubhava Dimri23-Jun-11 23:46
Anubhava Dimri23-Jun-11 23:46 
AnswerRe: Not Lost focus of form. Pin
Mario Majčica24-Jun-11 4:12
professionalMario Majčica24-Jun-11 4:12 
SuggestionRe: Not Lost focus of form. Pin
MicroVirus24-Jun-11 6:08
MicroVirus24-Jun-11 6:08 

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.