Click here to Skip to main content
11,648,094 members (66,488 online)
   

C#

 
QuestionRead structured text file to listview in C #? Pin
Member 245846730-Sep-12 23:10
memberMember 245846730-Sep-12 23:10 
AnswerRe: Read structured text file to listview in C #? Pin
Smart Arab30-Sep-12 23:19
memberSmart Arab30-Sep-12 23:19 
AnswerRe: Read structured text file to listview in C #? Pin
Eddy Vluggen1-Oct-12 1:01
memberEddy Vluggen1-Oct-12 1:01 
QuestionC# linq issue Pin
classy_dog30-Sep-12 20:00
memberclassy_dog30-Sep-12 20:00 
AnswerRe: C# linq issue Pin
Pete O'Hanlon30-Sep-12 20:15
protectorPete O'Hanlon30-Sep-12 20:15 
AnswerRe: C# linq issue Pin
DaveyM6930-Sep-12 22:54
mentorDaveyM6930-Sep-12 22:54 
AnswerRe: C# linq issue Pin
John Brett2-Oct-12 6:14
memberJohn Brett2-Oct-12 6:14 
QuestionHow to store string queries in c# function Pin
nitin_ion30-Sep-12 17:52
membernitin_ion30-Sep-12 17:52 
AnswerRe: How to store string queries in c# function Pin
Pete O'Hanlon30-Sep-12 19:33
protectorPete O'Hanlon30-Sep-12 19:33 
QuestionC# 2008 update sql server table Pin
dcof30-Sep-12 14:19
memberdcof30-Sep-12 14:19 
QuestionQuartzTypeLib and subtitles Pin
audaijihad30-Sep-12 6:22
memberaudaijihad30-Sep-12 6:22 
AnswerRe: QuartzTypeLib and subtitles Pin
Ravi Bhavnani30-Sep-12 6:47
memberRavi Bhavnani30-Sep-12 6:47 
GeneralRe: QuartzTypeLib and subtitles Pin
audaijihad30-Sep-12 11:33
memberaudaijihad30-Sep-12 11:33 
QuestionUpdating a Label in 2 forms simultaneously Pin
CSharpNewbie 229-Sep-12 21:37
memberCSharpNewbie 229-Sep-12 21:37 
Hi,
Here is my question...
I need to design two windows forms applications in such a way that the Form 1 will run for some time and then starts Form 2 in a new thread. Once the Form2 is started I need to update the labels on both the forms simultaneously.

Form1

public Form1()
{
Initialize();
DoSomeOperations();
}

public void DoSomeOperations()
{
updateLabel("Form 1");
Thread.Sleep(10000)
var task1= new Thread (() =>Form2()) {"GUIThread"};
task1.Start();
}

public void Form2()
{
Form2 f2= new Form2();
Application.Run(f2);
}
void updateLabel(string message)
{
label1.text = message; //label in Form1
label1.Refresh();

}

After Form2 is started, I wanted to update the label in Form 1 and Form2 at the same time. That is what ever message I get in Form 1, I need to display it both on Form 1 and Form2. I tried toraise an event in Updatelabel method and assigned the event to a method in the constructor of Form2 but it didnt work. Can somebody please help me with this?

Thanks in advance
AnswerRe: Updating a Label in 2 forms simultaneously Pin
Smart Arab29-Sep-12 22:40
memberSmart Arab29-Sep-12 22:40 
AnswerRe: Updating a Label in 2 forms simultaneously Pin
Dave Kreskowiak30-Sep-12 3:01
mvpDave Kreskowiak30-Sep-12 3:01 
GeneralRe: Updating a Label in 2 forms simultaneously Pin
CSharpNewbie 230-Sep-12 12:20
memberCSharpNewbie 230-Sep-12 12:20 
AnswerRe: Updating a Label in 2 forms simultaneously Pin
Emdad_54821-Oct-12 1:44
memberEmdad_54821-Oct-12 1:44 
QuestionC# check for null in linq Pin
dcof29-Sep-12 9:05
memberdcof29-Sep-12 9:05 
AnswerRe: C# check for null in linq Pin
Richard MacCutchan29-Sep-12 21:45
mvpRichard MacCutchan29-Sep-12 21:45 
QuestionEncrypt text file in C# Pin
gibsray29-Sep-12 7:09
membergibsray29-Sep-12 7:09 
AnswerRe: Encrypt text file in C# Pin
Smart Arab29-Sep-12 7:20
memberSmart Arab29-Sep-12 7:20 
AnswerRe: Encrypt text file in C# Pin
Sandip.Nascar29-Sep-12 8:53
memberSandip.Nascar29-Sep-12 8:53 
QuestionPattern for creating class libraries Pin
nitin_ion28-Sep-12 20:32
membernitin_ion28-Sep-12 20:32 
AnswerRe: Pattern for creating class libraries Pin
n.podbielski28-Sep-12 21:51
membern.podbielski28-Sep-12 21:51 
QuestionVisual Studio 10 Naming Issue? Pin
PDTUM28-Sep-12 9:57
memberPDTUM28-Sep-12 9:57 
AnswerRe: Visual Studio 10 Naming Issue? Pin
Emmanuel Medina Lopez28-Sep-12 11:07
memberEmmanuel Medina Lopez28-Sep-12 11:07 
GeneralRe: Visual Studio 10 Naming Issue? Pin
PDTUM28-Sep-12 13:31
memberPDTUM28-Sep-12 13:31 
AnswerRe: Visual Studio 10 Naming Issue? Pin
Smart Arab28-Sep-12 22:20
memberSmart Arab28-Sep-12 22:20 
GeneralRe: Visual Studio 10 Naming Issue? Pin
PDTUM3-Oct-12 5:25
memberPDTUM3-Oct-12 5:25 
GeneralRe: Visual Studio 10 Naming Issue? Pin
Smart Arab3-Oct-12 7:01
memberSmart Arab3-Oct-12 7:01 
QuestionC# database error Pin
classy_dog28-Sep-12 6:50
memberclassy_dog28-Sep-12 6:50 
AnswerRe: C# database error Pin
Matt U.28-Sep-12 6:59
memberMatt U.28-Sep-12 6:59 
AnswerRe: C# database error Pin
Emmanuel Medina Lopez28-Sep-12 9:40
memberEmmanuel Medina Lopez28-Sep-12 9:40 
QuestionImage compression Pin
hardiksince198728-Sep-12 6:13
memberhardiksince198728-Sep-12 6:13 
AnswerRe: Image compression Pin
Ravi Bhavnani28-Sep-12 6:15
memberRavi Bhavnani28-Sep-12 6:15 
AnswerRe: Image compression Pin
Abhinav S28-Sep-12 17:00
mvpAbhinav S28-Sep-12 17:00 
Questiongeneric queue synchronisation Pin
Ramu katturi28-Sep-12 3:18
memberRamu katturi28-Sep-12 3:18 
AnswerRe: generic queue synchronisation Pin
Dave Kreskowiak28-Sep-12 3:58
mvpDave Kreskowiak28-Sep-12 3:58 
Questionupdate in LINQ to SQL is not working for C#.Net? Pin
jini427-Sep-12 23:26
memberjini427-Sep-12 23:26 
AnswerRe: update in LINQ to SQL is not working for C#.Net? Pin
J4amieC28-Sep-12 0:09
memberJ4amieC28-Sep-12 0:09 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
jini428-Sep-12 0:18
memberjini428-Sep-12 0:18 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
Dave Kreskowiak28-Sep-12 1:22
mvpDave Kreskowiak28-Sep-12 1:22 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
jini430-Sep-12 19:44
memberjini430-Sep-12 19:44 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
Dave Kreskowiak1-Oct-12 2:05
mvpDave Kreskowiak1-Oct-12 2:05 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
anglesen11202-Oct-12 18:23
memberanglesen11202-Oct-12 18:23 
AnswerRe: update in LINQ to SQL is not working for C#.Net? Pin
Emmanuel Medina Lopez28-Sep-12 9:48
memberEmmanuel Medina Lopez28-Sep-12 9:48 
GeneralRe: update in LINQ to SQL is not working for C#.Net? Pin
jini430-Sep-12 19:41
memberjini430-Sep-12 19:41 
Questionupload a song into database... Pin
sri apple27-Sep-12 21:37
membersri apple27-Sep-12 21:37 
AnswerRe: upload a song into database... Pin
Smart Arab27-Sep-12 22:13
memberSmart Arab27-Sep-12 22:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web03 | 2.8.150804.4 | Last Updated 4 Aug 2015
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid