There is a code

public Form1 ()
        InitializeComponent ();
        Load_programm ();
    void Load_programm () {
MessageBox.Show ("I am a bubble wrap princess");

For some reason it seemed to me that the Load_programm () function should run after the program itself is fully loaded. But the message appears before the program is loaded. What to change?

you shouldn't do this kind of logic in a constructor. This must be done in the event handler. For example, OnLoad

DreamChild2021-02-23 03:19:51

private void Form1_OnLoad (object sender, System.EventArgs e) Now Messagebox is not loaded

Vlmake2021-02-23 03:19:51
  • Answer # 1

    The Shown form event seems to be fine. Fires after displaying the form