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. Click Event Problem

Click Event Problem

Scheduled Pinned Locked Moved C#
csharpcomdata-structureshelpquestion
10 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.
  • S Offline
    S Offline
    Semion_N
    wrote on last edited by
    #1

    Hello, I'm writing a program which draws charts and I'm followong this article: http://www.codeproject.com/csharp/zedgraph.asp[^] Here is my source code: http://paste.plone.org/12853[^] The problem is that when I click the Add Chart button nothing happens(as you could see on the picture http://img54.imageshack.us/img54/3590/addgk9.jpg[^] althought I call the createGraph function on this event. But when I click on the button and then on the graph itself like you could see on the picture it draws me(when I click just on the graph without the button nothing happens) http://img238.imageshack.us/img238/7291/firstrd8.jpg[^] I want that when I click on the "Add Chart" button it will draw me the chart. Why do this problem happens? I gave you the sorce code on the top if you need it. Thanks a lot and I hope I was pretty obvious.

    SnaidiS(Semion)

    F 1 Reply Last reply
    0
    • S Semion_N

      Hello, I'm writing a program which draws charts and I'm followong this article: http://www.codeproject.com/csharp/zedgraph.asp[^] Here is my source code: http://paste.plone.org/12853[^] The problem is that when I click the Add Chart button nothing happens(as you could see on the picture http://img54.imageshack.us/img54/3590/addgk9.jpg[^] althought I call the createGraph function on this event. But when I click on the button and then on the graph itself like you could see on the picture it draws me(when I click just on the graph without the button nothing happens) http://img238.imageshack.us/img238/7291/firstrd8.jpg[^] I want that when I click on the "Add Chart" button it will draw me the chart. Why do this problem happens? I gave you the sorce code on the top if you need it. Thanks a lot and I hope I was pretty obvious.

      SnaidiS(Semion)

      F Offline
      F Offline
      FocusedWolf
      wrote on last edited by
      #2

      I can think of one thing right away that you should check. i assume that this button you want to click, that isn't doing anything even though you have an action written for it, is not "wired" to the event. Here, select the button in the gui designer and go to its properties. then click the little lightning bolt in the propertygrid and goto its events... Now... if you see an empty box to the right of the "Click" event... then my guess is right and the event is not wired. Click inside that empty box, and a combobox-dropdown button should appear...hit it and, select "button1_Click" from the list. now it should work sometimes this happens when you paste stuff from other forms or something...

      S 1 Reply Last reply
      0
      • F FocusedWolf

        I can think of one thing right away that you should check. i assume that this button you want to click, that isn't doing anything even though you have an action written for it, is not "wired" to the event. Here, select the button in the gui designer and go to its properties. then click the little lightning bolt in the propertygrid and goto its events... Now... if you see an empty box to the right of the "Click" event... then my guess is right and the event is not wired. Click inside that empty box, and a combobox-dropdown button should appear...hit it and, select "button1_Click" from the list. now it should work sometimes this happens when you paste stuff from other forms or something...

        S Offline
        S Offline
        Semion_N
        wrote on last edited by
        #3

        No, the event of Click was already on button1_Click it didn't work.

        SnaidiS(Semion)

        F 1 Reply Last reply
        0
        • S Semion_N

          No, the event of Click was already on button1_Click it didn't work.

          SnaidiS(Semion)

          F Offline
          F Offline
          FocusedWolf
          wrote on last edited by
          #4

          hmm...then it's probably a logic bug in your code or that control or somewhere between. did you try setting a breakpoint and stepping into it? I'm not sure if you know this or not. you click in the margin to the left of this line "private void button1_Click(" and get a little red circle to appear...the breakpoint... then do debug -> start. and when you click the button, the code should run to that line.. then do debug -> "step into" and line after line see what gets executed and what doesn't. if you cant figure it out...you can send me you test project and i can try to find the problem. i know you posted the code, but i'm a bit lazy to recreate your project...and maybe theirs something not in the code thats messing it up :P

          S 1 Reply Last reply
          0
          • F FocusedWolf

            hmm...then it's probably a logic bug in your code or that control or somewhere between. did you try setting a breakpoint and stepping into it? I'm not sure if you know this or not. you click in the margin to the left of this line "private void button1_Click(" and get a little red circle to appear...the breakpoint... then do debug -> start. and when you click the button, the code should run to that line.. then do debug -> "step into" and line after line see what gets executed and what doesn't. if you cant figure it out...you can send me you test project and i can try to find the problem. i know you posted the code, but i'm a bit lazy to recreate your project...and maybe theirs something not in the code thats messing it up :P

            S Offline
            S Offline
            Semion_N
            wrote on last edited by
            #5

            :) I tried to debug it and when I click the button it makes the function but I dont see the results on screan.. OK, I'll upload the project. Here is the project. http://fileho.com/download/e95cc0167872/Graphics.rar.html[^] and listen If you have problem with the Graph Control so the dll is on the folder. Thanks :)

            SnaidiS(Semion)

            F 1 Reply Last reply
            0
            • S Semion_N

              :) I tried to debug it and when I click the button it makes the function but I dont see the results on screan.. OK, I'll upload the project. Here is the project. http://fileho.com/download/e95cc0167872/Graphics.rar.html[^] and listen If you have problem with the Graph Control so the dll is on the folder. Thanks :)

              SnaidiS(Semion)

              F Offline
              F Offline
              FocusedWolf
              wrote on last edited by
              #6

              my email is the username i use here @gmail... :P

              S 1 Reply Last reply
              0
              • F FocusedWolf

                my email is the username i use here @gmail... :P

                S Offline
                S Offline
                Semion_N
                wrote on last edited by
                #7

                I uploaded it http://fileho.com/download/e95cc0167872/Graphics.rar.html[^]

                SnaidiS(Semion)

                F 1 Reply Last reply
                0
                • S Semion_N

                  I uploaded it http://fileho.com/download/e95cc0167872/Graphics.rar.html[^]

                  SnaidiS(Semion)

                  F Offline
                  F Offline
                  FocusedWolf
                  wrote on last edited by
                  #8

                  ok i figured it out :P zgc.Invalidate(); add that to the end of your createGraph function. it tells that control that it needs to be invalidated cause its data was changed. its really the control makers fault here... they should of done that automatically when the data is changed :P if you ever get problems... zgc.Refresh(); this can do it and force the repaint to happen right away, but i think it might be slower... its better with invalidate :P their are other things like zgc.SuspendLayout() make lots of changes to the control zgc.ResumeLayout() if you encounter lots of flickering or whatnot ... these functions exist in all controls that inherit system.control or system.usercontrol fyi ...like if you ever get this problem in the future :P i was tipped off to the problem when while stepping through with the debugger that i saw the button working properly... and it was because the whole form was getting invalidated cause of the debugger kept on moving ontop of the window with each refresh..or something...

                  S 1 Reply Last reply
                  0
                  • F FocusedWolf

                    ok i figured it out :P zgc.Invalidate(); add that to the end of your createGraph function. it tells that control that it needs to be invalidated cause its data was changed. its really the control makers fault here... they should of done that automatically when the data is changed :P if you ever get problems... zgc.Refresh(); this can do it and force the repaint to happen right away, but i think it might be slower... its better with invalidate :P their are other things like zgc.SuspendLayout() make lots of changes to the control zgc.ResumeLayout() if you encounter lots of flickering or whatnot ... these functions exist in all controls that inherit system.control or system.usercontrol fyi ...like if you ever get this problem in the future :P i was tipped off to the problem when while stepping through with the debugger that i saw the button working properly... and it was because the whole form was getting invalidated cause of the debugger kept on moving ontop of the window with each refresh..or something...

                    S Offline
                    S Offline
                    Semion_N
                    wrote on last edited by
                    #9

                    Thanks! It works now, you are great! May the world be full with people like you :) Thanks !

                    SnaidiS(Semion)

                    F 1 Reply Last reply
                    0
                    • S Semion_N

                      Thanks! It works now, you are great! May the world be full with people like you :) Thanks !

                      SnaidiS(Semion)

                      F Offline
                      F Offline
                      FocusedWolf
                      wrote on last edited by
                      #10

                      Glad it worked :-D

                      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