Click here to Skip to main content
15,915,160 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to Create a setup file in c#.net3.5 windows application Pin
Narendra Reddy Vajrala7-Apr-09 2:31
Narendra Reddy Vajrala7-Apr-09 2:31 
GeneralRe: How to Create a setup file in c#.net3.5 windows application Pin
Henry Minute7-Apr-09 11:40
Henry Minute7-Apr-09 11:40 
QuestionCalculate the age in years,months and days using the datetimepicker. Pin
Schdev7-Apr-09 0:10
Schdev7-Apr-09 0:10 
AnswerRe: Calculate the age in years,months and days using the datetimepicker. Pin
stancrm7-Apr-09 0:27
stancrm7-Apr-09 0:27 
AnswerRe: Calculate the age in years,months and days using the datetimepicker. Pin
DaveyM697-Apr-09 1:02
professionalDaveyM697-Apr-09 1:02 
AnswerRe: Calculate the age in years,months and days using the datetimepicker. Pin
Henry Minute7-Apr-09 1:04
Henry Minute7-Apr-09 1:04 
AnswerRe: Calculate the age in years,months and days using the datetimepicker. Pin
Luc Pattyn7-Apr-09 3:50
sitebuilderLuc Pattyn7-Apr-09 3:50 
QuestionWriting to ListBox from multiple threads Pin
Bruce Coward7-Apr-09 0:00
Bruce Coward7-Apr-09 0:00 
I have a fairly standard Form1.cs with a listbox to display comms traffic. The comms traffic comes from two different interfaces each of which is handled by it's own background thread. I want to log the traffic in the listbox on Form1 and have set up a delegate / Invoke routine as below in the Form1 class:

//*********************************************************************
// public void log(string message)
// This function appends the message to the list box
//*********************************************************************
public delegate void LogDelegate(string s);
public void log(string message)
{
    if (InvokeRequired)
    {
        Invoke(new LogDelegate(log), new object[] { message });
    }
    else
    {
        lb.Items.Add(message);
        lb.TopIndex = lb.Items.Count - 1;
    }
} // End of void log()


When I try to call log(string) from either of the backgound threads the compiler isn't finding this function and I cant for the life of me see why not. I did try making it a static but that threw lots of errors so I took that away.

What am I doing wrong please?

Many thanks, Bruce Confused | :confused:
AnswerRe: Writing to ListBox from multiple threads Pin
Nicholas Butler7-Apr-09 0:52
sitebuilderNicholas Butler7-Apr-09 0:52 
GeneralRe: Writing to ListBox from multiple threads Pin
Bruce Coward7-Apr-09 1:04
Bruce Coward7-Apr-09 1:04 
GeneralRe: Writing to ListBox from multiple threads Pin
Nicholas Butler7-Apr-09 1:19
sitebuilderNicholas Butler7-Apr-09 1:19 
GeneralRe: Writing to ListBox from multiple threads Pin
Luc Pattyn7-Apr-09 3:53
sitebuilderLuc Pattyn7-Apr-09 3:53 
AnswerRe: Writing to ListBox from multiple threads Pin
Henry Minute7-Apr-09 1:15
Henry Minute7-Apr-09 1:15 
GeneralRe: Writing to ListBox from multiple threads Pin
Nicholas Butler7-Apr-09 1:23
sitebuilderNicholas Butler7-Apr-09 1:23 
GeneralRe: Writing to ListBox from multiple threads Pin
Henry Minute7-Apr-09 1:35
Henry Minute7-Apr-09 1:35 
GeneralRe: Writing to ListBox from multiple threads Pin
Bruce Coward7-Apr-09 1:24
Bruce Coward7-Apr-09 1:24 
GeneralRe: Writing to ListBox from multiple threads Pin
Henry Minute7-Apr-09 1:35
Henry Minute7-Apr-09 1:35 
GeneralRe: Writing to ListBox from multiple threads Pin
Bruce Coward7-Apr-09 1:40
Bruce Coward7-Apr-09 1:40 
AnswerRe: Writing to ListBox from multiple threads Pin
DaveyM697-Apr-09 2:22
professionalDaveyM697-Apr-09 2:22 
AnswerRe: Writing to ListBox from multiple threads Pin
Luc Pattyn7-Apr-09 4:05
sitebuilderLuc Pattyn7-Apr-09 4:05 
GeneralRe: Writing to ListBox from multiple threads - OT Pin
DaveyM697-Apr-09 5:14
professionalDaveyM697-Apr-09 5:14 
GeneralRe: Writing to ListBox from multiple threads - OT Pin
Luc Pattyn7-Apr-09 5:31
sitebuilderLuc Pattyn7-Apr-09 5:31 
Questionproblem when writing to eventlog Pin
prasadbuddhika6-Apr-09 23:56
prasadbuddhika6-Apr-09 23:56 
QuestionCreating a Collection of User Defined classes in a namespace and Invoking each class dynamicly Pin
grealish6-Apr-09 23:52
grealish6-Apr-09 23:52 
Questionan installation problem of excel addin Pin
abhiram_nayan6-Apr-09 23:48
abhiram_nayan6-Apr-09 23:48 

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.