Null Reference Exception while using threads
-
Hi I'm getting this error while trying to abort threads: "Object Reference Not set to an instance of an object" The code is:
try { Client_Login clog = new Client_Login(); clog.clnt_th.Abort(); clog.sock.Close(); thvideo.Abort();//main class thread } catch(System.NullReferenceException expnul) { MessageBox.Show(expnul.Message); }
plz help me out that How I abort my open threads as in above code some connection and threads are made in another class whereas the disconnect function is in main class.Shanzay
-
Hi I'm getting this error while trying to abort threads: "Object Reference Not set to an instance of an object" The code is:
try { Client_Login clog = new Client_Login(); clog.clnt_th.Abort(); clog.sock.Close(); thvideo.Abort();//main class thread } catch(System.NullReferenceException expnul) { MessageBox.Show(expnul.Message); }
plz help me out that How I abort my open threads as in above code some connection and threads are made in another class whereas the disconnect function is in main class.Shanzay
-
DeepOceans, Which line is the error on?, When aborting, closing "clog" or when aborting "thvideo". Also, also a good idea to use naming conversations: http://msdn2.microsoft.com/en-us/library/ms229045.aspx[^] Regards, Gareth.
Gareth, clog is the object to access the control of thread which is use in other class and if I comment-out the clog aborting line then error on the thvideo.abort().Means error just come on abort() whatever thread I'm aborting.Got it?
Shanzay