How To Fix Cannot Convert Method Group Error In C#

469 Views Asked by At

I have embedded several different tabs in a C # form of Windows and I want to use a save button for all of those tabs, but in such a way that this button only works by going to each tab for the same tab, not for tabs. Now I want to do this using the switch but I get the following error, thank you for your help

Error: Cannot convert method group 'Focus' to non-delegate type 'int'. Did you intend to invoke the method?

private void BtnSave_Click(object sender, EventArgs e)
{
    var tst1 = 0;

    switch (tst1)
    {
        case Tabp1.Focus:
            ListViewItem item = listView1.Items.Add(NameTB.Text);
            item.SubItems.Add(FamilTB.Text);
            item.SubItems.Add(AgeMTB.Text);
            item.SubItems.Add(ForceStatusCobx.Text);
            item.SubItems.Add(ForceTypeCobx.Text);
            item.SubItems.Add(PhNumMTB.Text);
            item.SubItems.Add(PirsonaliCodeMTB1.Text);


            NameTB.Text = string.Empty;
            FamilTB.Text = string.Empty;
            AgeMTB.Text = string.Empty;
            ForceStatusCobx.Text = string.Empty;
            ForceTypeCobx.Text = string.Empty;
            PhNumMTB.Text = string.Empty;
            ForceTypCobx.Text = string.Empty;
            PirsonaliCodeMTB1.Text = string.Empty;

            MessageBox.Show(
                "INFO IS register!",
                "Successful operation",
                MessageBoxButtons.OK,
                MessageBoxIcon.Asterisk
                );
            break;
    }
}
0

There are 0 best solutions below