C# button_click object sender



What is object sender, EventArgs e?

https://www.codeproject.com/Questions/1068892/What-is-object-sender-EventArgs-e


How to call a button click event from another method

https://stackoverflow.com/a/14479279/10763264



Sample coding

        void btnSBC_Click(object sender, EventArgs e)
        {
            String stncode = sender.ToString();
            stncode = stncode.Substring(stncode.IndexOf(":") + 1);
            stncode = stncode.Replace(" ", "");

            System.Windows.Forms.Button btn = (System.Windows.Forms.Button)sender;

            if(btn.BackColor.ToString() == "GreenYellow")
            {
                Form9 f9 = new Form9(connects, "Enabled", stncode);
                f9.ShowDialog();
            }
            else {
                Form9 f9 = new Form9(connects, "Disabled", stncode);
                f9.ShowDialog();
            }
        }

Ulasan

Catatan popular daripada blog ini

SISTEM PENGOPERASIAN KOMPUTER (OS)

JENIS-JENIS SISTEM PENGOPERASIAN KOMPUTER

APA ITU ASCII (AMERICAN STANDARD CODE FOR INFORMATION INTERCHANGE) ?