Highlighted
Absent Member.
Absent Member.
1289 views

VC for VS 2015 - form buttons

Jump to solution

I am building a calculator and have four buttons they used to work , so I must have accidentally changed something. Can some tell me how these aremade active? Is it in the properties?   

0 Likes
2 Solutions

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert
Buttons are tied to event handlers so that when an action occurs like button_Clicked then the event handler method will automatically be invoked. Double-clicking on the button should have inserted the event handler code into your program and inserted the code that adds the event handler method into the .designer.cbl file for the form.

You should be able to see if the event handlers are still in place by selecting the button and then clicking on the lightning bolt icon in the properties window which shows all of the event handlers tied to the control. Is there a handler for the button_Clicked event?

View solution in original post

Highlighted
Absent Member.
Absent Member.
There was not but I added it and all is well!

View solution in original post

6 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert
Buttons are tied to event handlers so that when an action occurs like button_Clicked then the event handler method will automatically be invoked. Double-clicking on the button should have inserted the event handler code into your program and inserted the code that adds the event handler method into the .designer.cbl file for the form.

You should be able to see if the event handlers are still in place by selecting the button and then clicking on the lightning bolt icon in the properties window which shows all of the event handlers tied to the control. Is there a handler for the button_Clicked event?

View solution in original post

Highlighted
Absent Member.
Absent Member.
I am curious as to what version of Visual COBOL you are on as we have experienced this on 2.2 as well. In our experience all of the event handlers have lost their connection (for some unknown reason) and you must go to the properties like Chris states and re-hook the event handler to the click, load, or other event. If you do not have many that is easily done, but if you have several it can be a pain and also a possibility to forget some. We have got into the habit of saving a copy of our work and using a compare tool to replace these event handlers much quicker (this is especially helpful if you have many event handlers in your program). We have tested 2.3 and it did not seem to have this problem, but we only did some brief testing where we tried to do some things that seemed to cause this problem. Thus my curiosity of what version you are using.

Thank you
0 Likes
Highlighted
Absent Member.
Absent Member.
i am using version 2.3 with VS 2015
0 Likes
Highlighted
Absent Member.
Absent Member.
P.S. I tried deleting and re-adding the button as a new one and also copied one that works and changed the text and name with no luck.
0 Likes
Highlighted
Absent Member.
Absent Member.

The problem I encountered is that the click event in the properties of the button would be blank and I would have to reset it using the drop down box to select the proper event I needed for it to run otherwise it would not work at all. If I double-clicked the button (In designer mode) it would just create another click event (btnAccept_Click(2)) that would be blank. We encounter this regularly in 2.2 and I was hoping it would be fixed in 2.3, but it sounds like it is still doing the same thing.

0 Likes
Highlighted
Absent Member.
Absent Member.
There was not but I added it and all is well!

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.