How to prevent value changed events from firing on form initialization in .NET?

后端 未结 10 2444
清歌不尽
清歌不尽 2020-12-03 07:01

Consider a simple .NET form with a couple of radio buttons and a checkbox.

Each of the radio buttons has a CheckedChanged handler setup that performs some action bas

10条回答
  •  臣服心动
    2020-12-03 07:48

    I put a public variable in the Module1 file Dim Public bolForm_LoadingTF as Boolean = True

    In each formLoad event I put bolForm_LoadingTF = True

    In each control with an OnSelectedIndexChanged event I put if bolForm_LoadingTF = True then Exit Sub

    At the end of the form load event I put bolForm_LoadingTF = False

    I am probably breaking a bunch of rules but this works for me.

提交回复
热议问题