If you are trying to execute code when Form.Show() is called, subscribing to Form.Shown() does not work. This is because Form.Shown() only gets executed once on the initial show. Instead you must subscribe to Form.VisibleChanged()
You also cannot use Form_Load, or Form_Activated, as load does not occur on .Show, and activate occurs too many times.
1 2 3 4 5 6 7 | private void Form_VisibleChanged(object sender, EventArgs e) { if (this.Visible) { //your code here } } |
You also cannot use Form_Load, or Form_Activated, as load does not occur on .Show, and activate occurs too many times.
Comments
Post a Comment