Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Dec 2000
    Thanked 0 Times in 0 Posts

    Public click event

    In A2K, is anyone aware of potential problems with making a controlbutton_click subroutine Public? If not problematic, is it a violation of "good programming practices"?


  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Public click event

    I make it a policy not to call control event procedures even from within the same form. Basically, the interface is between the user and the form, and the button click is effectively a public (but restricted) method of the form class. The button itself is the interface to that method. Allowing another form or other code to call the routine directly violates good class design.

    The problem is that when you make the code public (as opposed to the button), you run the risk of having code try to run that routine while the user is trying to do something else. You do NOT want the calls about the resulting error messages or the weird form behavior, believe me.

    That being said, it isn't good programming practice, but it depends on what you're trying to do. If you explain further, maybe someone can come up with a "better" programming alternative.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts