Click here to Skip to main content
15,923,845 members
Home / Discussions / C#
   

C#

 
QuestionSAPI speech problem! Pin
Warren2kx17-Jun-10 8:19
Warren2kx17-Jun-10 8:19 
AnswerRe: SAPI speech problem! Pin
Ravi Bhavnani17-Jun-10 8:49
professionalRavi Bhavnani17-Jun-10 8:49 
GeneralRe: SAPI speech problem! Pin
Warren2kx21-Jun-10 11:08
Warren2kx21-Jun-10 11:08 
GeneralRe: SAPI speech problem! Pin
Ravi Bhavnani21-Jun-10 11:13
professionalRavi Bhavnani21-Jun-10 11:13 
QuestionWhy cannot delegate set the form control? Pin
yu-jian17-Jun-10 7:55
yu-jian17-Jun-10 7:55 
AnswerRe: Why cannot delegate set the form control? Pin
Abhinav S17-Jun-10 8:08
Abhinav S17-Jun-10 8:08 
AnswerRe: Why cannot delegate set the form control? Pin
Luc Pattyn17-Jun-10 8:17
sitebuilderLuc Pattyn17-Jun-10 8:17 
AnswerRe: Why cannot delegate set the form control? Pin
Adam R Harris17-Jun-10 9:07
Adam R Harris17-Jun-10 9:07 
Luc is right.

Try something like this

using System;
using System.Windows.Forms;
namespace DelegateForm 
{
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }
        
        private void TestDelegate() {
            System.Threading.Thread.Sleep(1000);
            OnAdd2List myDelegate;
            myDelegate = new OnAdd2List(Add2List);
            myDelegate(DateTime.Now.ToString());
        }

        private void Add2List(string s) {
            AddItem(s);
        }

        private delegate void OnAdd2List(string s);
        private void button1_Click(object sender, EventArgs e) {
            this._thread = new System.Threading.Thread(new System.Threading.ThreadStart(TestDelegate));
            this._thread.Start();
        }

        private void button2_Click(object sender, EventArgs e) {
        }


	// a delegate to get called on the main thread if need be
	private delegate void delAddItem(string item);

        private void AddItem(string item){
	    // Check if the listview requires an invoke
	    if (listView1.InvokeRequired){
		// Create the delegate
		delAddItem del = new delAddItem(AddItem);
		// Invoke it in the main thread
		this.invoke(del, item);
	    }
	    else{
		// just add the new item
		listView1.Items.Add(item);
	    }
  	}

        private System.Threading.Thread _thread;
    }
}

If at first you don't succeed ... post it on The Code Project and Pray.

QuestionPInvoke for DirectoryInfo Class Pin
CodingDaddy17-Jun-10 7:12
CodingDaddy17-Jun-10 7:12 
AnswerRe: PInvoke for DirectoryInfo Class Pin
CodingDaddy18-Jun-10 4:03
CodingDaddy18-Jun-10 4:03 
QuestionHow to add License Functionality in Dot Net Assembly. Pin
codeproject_Tarun17-Jun-10 5:44
codeproject_Tarun17-Jun-10 5:44 
AnswerRe: How to add License Functionality in Dot Net Assembly. Pin
Ennis Ray Lynch, Jr.17-Jun-10 5:49
Ennis Ray Lynch, Jr.17-Jun-10 5:49 
GeneralRe: How to add License Functionality in Dot Net Assembly. Pin
codeproject_Tarun17-Jun-10 23:51
codeproject_Tarun17-Jun-10 23:51 
QuestionGroupBox Set To Back Pin
Endien17-Jun-10 5:36
Endien17-Jun-10 5:36 
AnswerRe: GroupBox DockStyle Pin
dan!sh 17-Jun-10 5:40
professional dan!sh 17-Jun-10 5:40 
GeneralRe: GroupBox DockStyle Pin
Endien17-Jun-10 5:55
Endien17-Jun-10 5:55 
AnswerRe: GroupBox Set To Back Pin
Luc Pattyn17-Jun-10 6:32
sitebuilderLuc Pattyn17-Jun-10 6:32 
GeneralRe: GroupBox Set To Back Pin
Endien17-Jun-10 6:58
Endien17-Jun-10 6:58 
GeneralRe: GroupBox Set To Back Pin
Luc Pattyn17-Jun-10 7:15
sitebuilderLuc Pattyn17-Jun-10 7:15 
GeneralRe: GroupBox Set To Back Pin
Endien17-Jun-10 7:16
Endien17-Jun-10 7:16 
GeneralRe: GroupBox Set To Back Pin
Endien17-Jun-10 7:34
Endien17-Jun-10 7:34 
Questioninstallation of c# project Pin
prithaa17-Jun-10 5:11
prithaa17-Jun-10 5:11 
AnswerRe: installation of c# project Pin
dan!sh 17-Jun-10 5:36
professional dan!sh 17-Jun-10 5:36 
QuestionNeed to call methods in Java classes Pin
Adam Brown 317-Jun-10 4:34
Adam Brown 317-Jun-10 4:34 
AnswerRe: Need to call methods in Java classes Pin
dan!sh 17-Jun-10 4:48
professional dan!sh 17-Jun-10 4: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.