Click here to Skip to main content
15,886,067 members
Home / Discussions / C#
   

C#

 
Questionthe use of Lambda and action delegate Pin
Tridip Bhattacharjee9-Dec-12 21:17
professionalTridip Bhattacharjee9-Dec-12 21:17 
AnswerRe: the use of Lambda and action delegate Pin
Eddy Vluggen9-Dec-12 23:04
professionalEddy Vluggen9-Dec-12 23:04 
AnswerRe: the use of Lambda and action delegate Pin
Freak309-Dec-12 23:11
Freak309-Dec-12 23:11 
QuestionI thought understood file io Pin
David C# Hobbyist.9-Dec-12 10:10
professionalDavid C# Hobbyist.9-Dec-12 10:10 
AnswerRe: I thought understood file io Pin
Wendelius9-Dec-12 10:29
mentorWendelius9-Dec-12 10:29 
AnswerRe: I thought understood file io Pin
Dave Kreskowiak9-Dec-12 12:23
mveDave Kreskowiak9-Dec-12 12:23 
AnswerRe: I thought understood file io Pin
Pete O'Hanlon9-Dec-12 18:20
mvePete O'Hanlon9-Dec-12 18:20 
QuestionWhat's the relation of delegate and threading Pin
mohammadkaab9-Dec-12 8:09
mohammadkaab9-Dec-12 8:09 
Hi guys . i'm working on a small project , is related to a socket programming . it's kind of chat program just we have one server and plenty of client . i have done every thing right . and im getting the result in the message box when a client sent me sth . but the problem is here when i'm trying to just put the string or the word that the client sent me into a textbox , it'll give me an error and i know wht it give me this kind of error , im using a while loop into my server program so when i start the program it get stop(hang) till get the message of the client so i figure out to run it into a new thread . i think you get the idea why this kind of error is appear to me , so i just decide to use the delegate the code its like this .

C#
Thread thr;
public delegate void Dosth();
string sth = "";
private void buttonX1_Click(object sender, EventArgs e)
        {
            thr = new Thread(Listen);
            thr.Start();   
        }
void Listen()
        {
            Soc.Bind(ipend);
            Soc.Listen(10);
            
            byte[] data = new byte[500];
            while (true)
            {
                // Accept the connection
                Socket client = Soc.Accept();
                client.Receive(data);
                sth = Encoding.ASCII.GetString(data);
                // calling the method to show the string into a textbox
                athreadedfunction();
               .
               .
               .


            }
        }
 public void writeintotext()
        {
            textBox1.Text = sth;
        }
        public void athreadedfunction()
        {
            Dosth writeinto = new Dosth(writeintotext);
            textBox1.Invoke(writeinto);
        }

what do i need to know is how the invoke + delegate done sth and let the error disapear .
and i know the delegate is kind of pointer to the method or functions .
but what does mean of the invoke here ?
and how this error ("Cross-thread operation not valid: Control 'textBox1'") didnt appear to me when i used this piece of code.
plz help me in that i want to know how that done .
and im sorry about my poor english .
AnswerRe: What's the relation of delegate and threading Pin
Shameel10-Dec-12 21:19
professionalShameel10-Dec-12 21:19 
QuestionHow to pass variables from main window to Html file Pin
amiraf1239-Dec-12 3:43
amiraf1239-Dec-12 3:43 
AnswerRe: How to pass variables from main window to Html file Pin
Eddy Vluggen9-Dec-12 23:09
professionalEddy Vluggen9-Dec-12 23:09 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 0:51
amiraf12310-Dec-12 0:51 
GeneralRe: How to pass variables from main window to Html file Pin
Eddy Vluggen10-Dec-12 1:48
professionalEddy Vluggen10-Dec-12 1:48 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 2:36
amiraf12310-Dec-12 2:36 
GeneralRe: How to pass variables from main window to Html file Pin
Eddy Vluggen10-Dec-12 3:00
professionalEddy Vluggen10-Dec-12 3:00 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12310-Dec-12 3:36
amiraf12310-Dec-12 3:36 
GeneralRe: How to pass variables from main window to Html file Pin
Eddy Vluggen11-Dec-12 2:19
professionalEddy Vluggen11-Dec-12 2:19 
GeneralRe: How to pass variables from main window to Html file Pin
amiraf12311-Dec-12 3:56
amiraf12311-Dec-12 3:56 
QuestionWCF REST Service : Using Bing Map Pin
Vijay Kanda8-Dec-12 20:56
Vijay Kanda8-Dec-12 20:56 
AnswerRe: WCF REST Service : Using Bing Map Pin
OriginalGriff8-Dec-12 22:36
mveOriginalGriff8-Dec-12 22:36 
AnswerRe: WCF REST Service : Using Bing Map Pin
Richard MacCutchan8-Dec-12 22:40
mveRichard MacCutchan8-Dec-12 22:40 
GeneralRe: WCF REST Service : Using Bing Map Pin
Vijay Kanda9-Dec-12 10:33
Vijay Kanda9-Dec-12 10:33 
GeneralRe: WCF REST Service : Using Bing Map Pin
Richard MacCutchan9-Dec-12 21:30
mveRichard MacCutchan9-Dec-12 21:30 
QuestionUsing Bing map or google geocoder Pin
Vijay Kanda8-Dec-12 14:08
Vijay Kanda8-Dec-12 14:08 
AnswerRe: Using Bing map or google geocoder Pin
Simon_Whale8-Dec-12 23:43
Simon_Whale8-Dec-12 23:43 

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.