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. exception

exception

Scheduled Pinned Locked Moved C#
help
10 Posts 3 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.
  • P Offline
    P Offline
    Parshant Verma
    wrote on last edited by
    #1

    HI i use three panel and each panel there are two or three buttons. each buton has MouseEnter and MouseLeave events.They are working fine But whenever i go throght 2nd panel by next button.there are two button one for Browse a file another for Browse a folder whaenever i click on Browse a folder button ,dialogbox appear and work fine But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event . and whenever i comment the MouseEnter event line it dispaly error in Mouse leave event. and when i comment this line also it dispaly same exception at another control Mouse event plz help parshant

    N G 2 Replies Last reply
    0
    • P Parshant Verma

      HI i use three panel and each panel there are two or three buttons. each buton has MouseEnter and MouseLeave events.They are working fine But whenever i go throght 2nd panel by next button.there are two button one for Browse a file another for Browse a folder whaenever i click on Browse a folder button ,dialogbox appear and work fine But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event . and whenever i comment the MouseEnter event line it dispaly error in Mouse leave event. and when i comment this line also it dispaly same exception at another control Mouse event plz help parshant

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      Telling what exception you are getting is generally more helpful than

      Parshant Verma wrote:

      dispaly exception at MouseEnter


      only two letters away from being an asset

      P 1 Reply Last reply
      0
      • P Parshant Verma

        HI i use three panel and each panel there are two or three buttons. each buton has MouseEnter and MouseLeave events.They are working fine But whenever i go throght 2nd panel by next button.there are two button one for Browse a file another for Browse a folder whaenever i click on Browse a folder button ,dialogbox appear and work fine But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event . and whenever i comment the MouseEnter event line it dispaly error in Mouse leave event. and when i comment this line also it dispaly same exception at another control Mouse event plz help parshant

        G Offline
        G Offline
        Guffa
        wrote on last edited by
        #3

        Parshant Verma wrote:

        But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event .

        I don't understand what you mean by that sentence. What is appearing over the form?

        --- b { font-weight: normal; }

        P 1 Reply Last reply
        0
        • N Not Active

          Telling what exception you are getting is generally more helpful than

          Parshant Verma wrote:

          dispaly exception at MouseEnter


          only two letters away from being an asset

          P Offline
          P Offline
          Parshant Verma
          wrote on last edited by
          #4

          it display exceptio: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.drawing.dll Additional information: png1\001.png and also open a Disassmebly and point to 00000056 mov ecx,esi

          N 1 Reply Last reply
          0
          • G Guffa

            Parshant Verma wrote:

            But when i click on Browse for file button if appear over the form and also covered the button and dispaly exception at MouseEnter event .

            I don't understand what you mean by that sentence. What is appearing over the form?

            --- b { font-weight: normal; }

            P Offline
            P Offline
            Parshant Verma
            wrote on last edited by
            #5

            my mean it this whenever i click on file button OpenFileDialog open and covered the file button Might be it relate to exception that why i told this point

            G 1 Reply Last reply
            0
            • P Parshant Verma

              it display exceptio: An unhandled exception of type 'System.IO.FileNotFoundException' occurred in system.drawing.dll Additional information: png1\001.png and also open a Disassmebly and point to 00000056 mov ecx,esi

              N Offline
              N Offline
              Not Active
              wrote on last edited by
              #6

              and you really don't understand why you are getting this exception?:rolleyes::wtf::sigh:


              only two letters away from being an asset

              P 1 Reply Last reply
              0
              • N Not Active

                and you really don't understand why you are getting this exception?:rolleyes::wtf::sigh:


                only two letters away from being an asset

                P Offline
                P Offline
                Parshant Verma
                wrote on last edited by
                #7

                Exception says file not found i am getting but the same code working with another button Folder browse.

                1 Reply Last reply
                0
                • P Parshant Verma

                  my mean it this whenever i click on file button OpenFileDialog open and covered the file button Might be it relate to exception that why i told this point

                  G Offline
                  G Offline
                  Guffa
                  wrote on last edited by
                  #8

                  I see. What is the exception that you get, and what does the code look like?

                  --- b { font-weight: normal; }

                  P 1 Reply Last reply
                  0
                  • G Guffa

                    I see. What is the exception that you get, and what does the code look like?

                    --- b { font-weight: normal; }

                    P Offline
                    P Offline
                    Parshant Verma
                    wrote on last edited by
                    #9

                    exception i am getting file not found but before click on the file button everything going perfect and the same evevt is fine working private void btn_select_file_MouseEnter(object sender, System.EventArgs e) { try { file.Image=System.Drawing.Image.FromFile(@"png1\002.png"); } catch (System.Exception e1) { MessageBox.Show(e1.Message.ToString()); } } private void btn_select_file_MouseLeave(object sender, System.EventArgs e) { try { btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\001.png"); } catch (System.Exception e2) { MessageBox.Show(e2.Message.ToString()); } } private void btn_select_file_Click(object sender, System.EventArgs e) { if(openFileDialog.ShowDialog()==DialogResult.OK) { btn_select_file.DialogResult=DialogResult.OK; btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\002.png"); txt_select_file.Text=openFileDialog.FileName.ToString(); SelectButton=1; btn_select_folder.Enabled=false; } }

                    G 1 Reply Last reply
                    0
                    • P Parshant Verma

                      exception i am getting file not found but before click on the file button everything going perfect and the same evevt is fine working private void btn_select_file_MouseEnter(object sender, System.EventArgs e) { try { file.Image=System.Drawing.Image.FromFile(@"png1\002.png"); } catch (System.Exception e1) { MessageBox.Show(e1.Message.ToString()); } } private void btn_select_file_MouseLeave(object sender, System.EventArgs e) { try { btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\001.png"); } catch (System.Exception e2) { MessageBox.Show(e2.Message.ToString()); } } private void btn_select_file_Click(object sender, System.EventArgs e) { if(openFileDialog.ShowDialog()==DialogResult.OK) { btn_select_file.DialogResult=DialogResult.OK; btn_select_file.BackgroundImage=System.Drawing.Image.FromFile(@"png1\002.png"); txt_select_file.Text=openFileDialog.FileName.ToString(); SelectButton=1; btn_select_folder.Enabled=false; } }

                      G Offline
                      G Offline
                      Guffa
                      wrote on last edited by
                      #10

                      This last information that you provided suddenly makes the error very obvious. It has nothing at all to do with event handling. You are opening files using a relative path, that means that you are using the current working directory as a starting point. The file selector dialog also uses the current working directory, and changes it as you navigate through the folders. That means that your code is trying to open the image files from a different starting point, where the images doesn't exist. The quick solution would be to store the value of the current directory when starting the application, so that you could use that value for locating the images. But I don't understand why you create a new Image object from a file every time the mouse pointer enters or leaves the control. You'd be better off by loading the images at startup, so that you can use the same Image objects over and over.

                      --- b { font-weight: normal; }

                      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