Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Null Reference Exception while using threads

Null Reference Exception while using threads

Scheduled Pinned Locked Moved C#
help
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    DeepOceans
    wrote on last edited by
    #1

    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

    G 1 Reply Last reply
    0
    • D DeepOceans

      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

      G Offline
      G Offline
      Gareth H
      wrote on last edited by
      #2

      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.

      D 1 Reply Last reply
      0
      • G Gareth H

        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.

        D Offline
        D Offline
        DeepOceans
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups