<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Cross-thread operation not valid: Control &#8216;Form1&#8242; accessed from a thread other than the thread it was created on</title>
	<atom:link href="http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/feed/" rel="self" type="application/rss+xml" />
	<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/</link>
	<description>Nishant's coding tips,tricks,hacks,gotchas</description>
	<lastBuildDate>Fri, 13 Nov 2009 15:00:12 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Kathir</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2820</link>
		<dc:creator>Kathir</dc:creator>
		<pubDate>Thu, 05 Nov 2009 15:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2820</guid>
		<description>Hi,

 I&#039;ve used this and getting the &quot;Cross-thread operation not valid: Control &#039;&#039; accessed from a thread other than the thread it was created on&quot; exception still

public partial class Form1 : Form
{
delegate Control ControlCreateDelegate();
private delegate void SetNewControlCallback();
Control c;

public Form1()
        {
            InitializeComponent();
            
            
            ControlCreateDelegate cdr = new ControlCreateDelegate(CreateMyControl);
            cdr.BeginInvoke(new AsyncCallback(ControlCreationFinished), null);

        }
 Control CreateMyControl()
        {
            return new ClassLibrary1.MyUserControl().CreateMyControl();
        }
 void ControlCreationFinished(IAsyncResult ar)
        {
            int id = Thread.CurrentThread.ManagedThreadId;
            c = cdr.EndInvoke(ar);
            c.Text = String.Format(&quot;Textbox created by thread {0}&quot;, Thread.CurrentThread.ManagedThreadId);
            c.Width = TextRenderer.MeasureText(c.Text, c.Font).Width;
            c.Location = new Point(0, 100);
            this.Invoke( new MethodInvoker(SetNewControl));
            this.EnableButton();
        }
void SetNewControl()
        {
            int id = Thread.CurrentThread.ManagedThreadId;
            if (InvokeRequired)
            {
                SetNewControlCallback callBack = new SetNewControlCallback(SetNewControl);
                this.Invoke(new MethodInvoker(callBack));
                //return;
            }
            else
                this.panel1.Controls.Add(c);   //// &lt;&lt;&lt; Getting error at this line
        }
}

Thanks for help.

-Kathir</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p> I&#8217;ve used this and getting the &#8220;Cross-thread operation not valid: Control &#8221; accessed from a thread other than the thread it was created on&#8221; exception still</p>
<p>public partial class Form1 : Form<br />
{<br />
delegate Control ControlCreateDelegate();<br />
private delegate void SetNewControlCallback();<br />
Control c;</p>
<p>public Form1()<br />
        {<br />
            InitializeComponent();</p>
<p>            ControlCreateDelegate cdr = new ControlCreateDelegate(CreateMyControl);<br />
            cdr.BeginInvoke(new AsyncCallback(ControlCreationFinished), null);</p>
<p>        }<br />
 Control CreateMyControl()<br />
        {<br />
            return new ClassLibrary1.MyUserControl().CreateMyControl();<br />
        }<br />
 void ControlCreationFinished(IAsyncResult ar)<br />
        {<br />
            int id = Thread.CurrentThread.ManagedThreadId;<br />
            c = cdr.EndInvoke(ar);<br />
            c.Text = String.Format(&#8220;Textbox created by thread {0}&#8221;, Thread.CurrentThread.ManagedThreadId);<br />
            c.Width = TextRenderer.MeasureText(c.Text, c.Font).Width;<br />
            c.Location = new Point(0, 100);<br />
            this.Invoke( new MethodInvoker(SetNewControl));<br />
            this.EnableButton();<br />
        }<br />
void SetNewControl()<br />
        {<br />
            int id = Thread.CurrentThread.ManagedThreadId;<br />
            if (InvokeRequired)<br />
            {<br />
                SetNewControlCallback callBack = new SetNewControlCallback(SetNewControl);<br />
                this.Invoke(new MethodInvoker(callBack));<br />
                //return;<br />
            }<br />
            else<br />
                this.panel1.Controls.Add(c);   //// &lt;&lt;&lt; Getting error at this line<br />
        }<br />
}</p>
<p>Thanks for help.</p>
<p>-Kathir</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2809</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:55:54 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2809</guid>
		<description>PauddyWeand, that is a super great idea!</description>
		<content:encoded><![CDATA[<p>PauddyWeand, that is a super great idea!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2808</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Fri, 02 Oct 2009 18:54:57 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2808</guid>
		<description>Amar Kadam, do your own homework!</description>
		<content:encoded><![CDATA[<p>Amar Kadam, do your own homework!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: EsosteWrork</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2784</link>
		<dc:creator>EsosteWrork</dc:creator>
		<pubDate>Fri, 14 Aug 2009 03:20:44 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2784</guid>
		<description>What&#039;s up, is there anybody else here?
If it&#039;s not just all bots here, let me know. I&#039;m looking to network
Oh, and yes I&#039;m a real person LOL.

Later,</description>
		<content:encoded><![CDATA[<p>What&#8217;s up, is there anybody else here?<br />
If it&#8217;s not just all bots here, let me know. I&#8217;m looking to network<br />
Oh, and yes I&#8217;m a real person LOL.</p>
<p>Later,</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jatin</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2781</link>
		<dc:creator>Jatin</dc:creator>
		<pubDate>Mon, 10 Aug 2009 10:59:55 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2781</guid>
		<description>I have tried the same, it has solved the cross thread exception,, but the memory foot print is increased very much.. Any help on why memory utilisation is increased and how to decrease it ??</description>
		<content:encoded><![CDATA[<p>I have tried the same, it has solved the cross thread exception,, but the memory foot print is increased very much.. Any help on why memory utilisation is increased and how to decrease it ??</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Willyx</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2731</link>
		<dc:creator>Willyx</dc:creator>
		<pubDate>Sat, 06 Jun 2009 23:57:13 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2731</guid>
		<description>Hi, i&#039;m doing an asynchronous webservice call and I get the Cross-thread operation not valid: &quot;Control ‘Form1′ accessed ...&quot; error. I&#039;ve spend all day looking for solution but... hey, it&#039;s your same problem...
Trying your solution...
WORKS!!!!!!!
I own u a beer!</description>
		<content:encoded><![CDATA[<p>Hi, i&#8217;m doing an asynchronous webservice call and I get the Cross-thread operation not valid: &#8220;Control ‘Form1′ accessed &#8230;&#8221; error. I&#8217;ve spend all day looking for solution but&#8230; hey, it&#8217;s your same problem&#8230;<br />
Trying your solution&#8230;<br />
WORKS!!!!!!!<br />
I own u a beer!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: vishal</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2688</link>
		<dc:creator>vishal</dc:creator>
		<pubDate>Wed, 13 May 2009 05:20:28 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2688</guid>
		<description>thanks it worked for me ..</description>
		<content:encoded><![CDATA[<p>thanks it worked for me ..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Amar Kadam</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2539</link>
		<dc:creator>Amar Kadam</dc:creator>
		<pubDate>Wed, 25 Feb 2009 12:23:51 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2539</guid>
		<description>Nice Solution.

I am new in multithreading. Please give me detail information about multithreading.</description>
		<content:encoded><![CDATA[<p>Nice Solution.</p>
<p>I am new in multithreading. Please give me detail information about multithreading.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: PauddyWeand</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2521</link>
		<dc:creator>PauddyWeand</dc:creator>
		<pubDate>Thu, 22 Jan 2009 01:47:36 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2521</guid>
		<description>Nothing seems to be easier than seeing someone whom you can help but not helping.
I suggest we start giving it a try. Give love to the ones that need it.
God will appreciate it.</description>
		<content:encoded><![CDATA[<p>Nothing seems to be easier than seeing someone whom you can help but not helping.<br />
I suggest we start giving it a try. Give love to the ones that need it.<br />
God will appreciate it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: FeangeEnalM</title>
		<link>http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2504</link>
		<dc:creator>FeangeEnalM</dc:creator>
		<pubDate>Wed, 03 Dec 2008 20:20:49 +0000</pubDate>
		<guid isPermaLink="false">http://nishantpant.wordpress.com/2007/05/21/cross-thread-operation-not-valid-control-form1-accessed-from-a-thread-other-than-the-thread-it-was-created-on/#comment-2504</guid>
		<description>I am here at a forum newcomer. Until I read and deal with the forum.
Let&#039;s learn!</description>
		<content:encoded><![CDATA[<p>I am here at a forum newcomer. Until I read and deal with the forum.<br />
Let&#8217;s learn!</p>
]]></content:encoded>
	</item>
</channel>
</rss>
