Hi Everyone !
I am newbie in C# and i have problem when start new project.
My project include : One mainform and two child form ( Assetform and Loginform) and in Asset form i have a button call " Remove". here is some describe of how my program work :
- At the beginning of program, the form Asset start with the main form and the button " Remove " is disabled
- When i login, with form login => the button " Remove" is Enabled

and my problem is, i can't control the button in form1.

I have read some thread in our communicity and found somethings exciting. i tried it and gave this code for my problem :
in frmAsset form

Public Button Removebutton()
{
get{ return (btnRemove);}
}

in Login Form :

 private void Loginbtn_Click(object sender, EventArgs e)
        {
            if (tlogin.Text == "Administrator" && tpass.Text == "fch.123")
            {
            frmAsset Form2 = new frmAsset();
                frmAsset.RemoveButton.Enabled=true;             
                MessageBox.Show("Welcome", "Note", MessageBoxButtons.OK, MessageBoxIcon.Information);
                Close();

            }
            else
            {
                MessageBox.Show("Wrong password and username", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }

But with this code , i still can't solve my problem. is there anyone has experience about this? Can you help me ?

Try removing line 5 in the login form. frmAsset is already showing you shouldn't need to initialize a new one.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.