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. Why does this exception rarely throw?

Why does this exception rarely throw?

Scheduled Pinned Locked Moved C#
questiondebuggingtutorial
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.
  • M Offline
    M Offline
    mkomasi
    wrote on last edited by
    #1

    I am using a datagrid in my form sometimes when a child form of this datagrid form closed an exception like "Column C does not belong to the table T" was thrown. this exception is rarely occured so rarely and I can not find the way that it was generated, so I can not debug the the exception. does anybody know how to generate this exception and how to handle it.

    S 1 Reply Last reply
    0
    • M mkomasi

      I am using a datagrid in my form sometimes when a child form of this datagrid form closed an exception like "Column C does not belong to the table T" was thrown. this exception is rarely occured so rarely and I can not find the way that it was generated, so I can not debug the the exception. does anybody know how to generate this exception and how to handle it.

      S Offline
      S Offline
      sreejith ss nair
      wrote on last edited by
      #2

      hi, The exception is because you are accessing some column which is doesn't belongs to that perticular table. Reason may you are using datatable which is in form1 to some other form. And the point your are closing the form. The entire object are disposed. See better try to catch your exception and getback to me. try { //Put your logic here } catch(exception Ex) { MessageBox.Show(Ex.Message.ToString()); } Check what are the avilable (members) which you are accessing outside your form1 class file. ************************** S r e e j i t h N a i r **************************

      M 1 Reply Last reply
      0
      • S sreejith ss nair

        hi, The exception is because you are accessing some column which is doesn't belongs to that perticular table. Reason may you are using datatable which is in form1 to some other form. And the point your are closing the form. The entire object are disposed. See better try to catch your exception and getback to me. try { //Put your logic here } catch(exception Ex) { MessageBox.Show(Ex.Message.ToString()); } Check what are the avilable (members) which you are accessing outside your form1 class file. ************************** S r e e j i t h N a i r **************************

        M Offline
        M Offline
        mkomasi
        wrote on last edited by
        #3

        Thanks for your guide. I know how can I catch the exceptions in my codes. Also I know if a column does not belong to a table, I couldn't access the column. But if you read my message again I describe that this error is appeared so rarely. So I couldn't catch it. regards, Mehdi

        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