2 Replies - 232 Views - Last Post: 20 April 2019 - 06:07 AM Rate Topic: -----

#1 theatreboy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-April 19

code repeat or not

Posted 20 April 2019 - 04:17 AM

Thank you for adding me to the forum.

I have a general question about repeated code within a project.

When a set of code needs to be repeated to enable and disable controls on a form, is it best practice to repeat the code many times or to create a non-visible command button and set its value to true each time you need to run that code?

Just a thought.

Daniel.
Is This A Good Question/Topic? 0
  • +

Replies To: code repeat or not

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6807
  • View blog
  • Posts: 28,143
  • Joined: 12-December 12

Re: code repeat or not

Posted 20 April 2019 - 05:02 AM

Avoid repeating code. You do not need to simulate pressing a button. A property of the form and isolating an event(s) that would trigger the reevaluation of the property (and calling a single method) is a better approach.
Was This Post Helpful? 0
  • +
  • -

#3 theatreboy   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 20-April 19

Re: code repeat or not

Posted 20 April 2019 - 06:07 AM

Thank you very much. I will do just that.

Daniel.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1