Skip to main content

Exception Cross-thread

Exception:- Cross-thread operation not valid: Control 'treeView' accessed from a thread other than the thread it was created on.

I have kept treeview, You can replace it with control of your choice

Solution

  if (treeView.InvokeRequired)
                    {
                        this.Invoke((MethodInvoker)delegate()
                        {
                         
                            tn = treeView.SelectedNode;
                          
                        });
                    }

This website helped me a lot http://www.daniweb.com/forums/thread285535.html

Check the solution by Farooqaaa: http://www.daniweb.com/forums/post1228357.html#post1228357

Comments

Popular posts from this blog

Static Keyword in C#, unleashing Static keyword in C#

What is Static keyword in C# “Static” keyword can be used for declaring a static member . The keyword Static can be applied to the Classes, field, method, properties, operator, event and constructors. Methods and variable  which we use as static doesn't need an instance to be created of a class. Example of static keyword class testclass {     public static int statint;     public static void squareroot(); } we can call the above static method and variable without creating the instance of the class How to call a static method  testclass.squareroot(); apart from this the static method can use only the static variables of same class.

Http 500.50 URL Rewrite Error

Symptoms: HTTP Error 500.50 - URL Rewrite Module Error. Error Information Module- RewriteModule Images are broken and not displayed in wordpress, Images are displayed when you edit them,Wordpress Images Broken, Wordpress Images Upload Issue This post if for the people who are searching all the pages over internet for " HTTP Error 500.50 - URL Rewrite Module Error". You might be searching for the pages which will give you solution to install/uninstall the url rewrite module.When you are running Wordpress on Windows server 2008 these types of error pops up.  So I scratched my head and started searching and found out one website which is useful in this type of error. Then I filtered everything and prepared a process for this.This will reduce your turn around time. Step-1: Open PHP.ini and search for  "upload_tmp_dir" and change the value to windows temp directory "C:\Windows\Temp" Step-2: Right click On the Windows/Temp folder and assi...

delete service in windows server 2008/server 2003/xp/ vista

How to delete a service in windows server 2008/server 2003/xp/ vista. Note: There are some services which are system specific and cannot be stopped, Be careful while deleting a service The command to delete the service is "sc delete " The above command executes in DOS prompt.  An error will will come when you execute this command: "[SC] OpenService FAILED 5:" To remove this error and to execute the command in good manner.  When you open the command prompt , run it as administrator and then type : "sc delete " This is how to delete the service Start/Stop the service  You  can also start the service by Control panel-->administrative tools--> Services Right Click on the selected service and start/stop it Ps Note: Before deleting a service in windows server 2008/server 2003/xp/ vista you should confirm the name of service and research in google the effect after you  delete a service. It is difficult to recall the service back...