Quantcast
Viewing all articles
Browse latest Browse all 12583

changing button background color from another form button

Have a button on frmMain that opens frmContact.  frmContact can stay open but may be hidden by other forms opening or even frmMain.  I can change the button on frmMain to a different color when frmContact opens.  What I am having difficulty with is closing frmContact from its close button and having the frmMain button return to the default background color.  I am aware of needing to reset to true the UseVisualStyleBackground and backcolor to system.control.  Can someone help walk me thru this?  Thanks...John
 

EDIT/UPDATE:  Okay, I have tried the following but there is no change to the color.  I changed the button in frmMain modifier to public.  There are no errors when it runs and when I step thru it shows just what is should show and frmContact closes but the button on frmMain does not return to the initial control color.  Here is the code I have so far.  Can anyone see what is missing or wrong?  Thanks.

 
        //closing of the contact form
        private void btnCloseContact_Click(object sender, EventArgs e)
        {

            frmCompany company = new frmCompany();
            company.btnCompanyContact.BackColor = SystemColors.Control;
            company.btnCompanyContact.UseVisualStyleBackColor = true;

            Close();

        }


Viewing all articles
Browse latest Browse all 12583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>