Click here to Skip to main content
15,889,992 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All
Am new in c# coding.
On my project i want to customize frmAdminIndex toolstrip menu (item visibility change) .The frmAdminIndex was cusytomized by using Checkbox placed in frmDashBoard.Both Code attached

Code to Control
C#
namespace InventoryMnt
{
    public partial class<big> frmAdminIndex : Form</big>
    {
        Sales2Method salesMethod = new Sales2Method();

        public frmAdminIndex()
        {
            InitializeComponent();
        }
        public frmAdminIndex(string Emp1)
        {
            InitializeComponent();
            Emp = Emp1;

        }

        public frmAdminIndex(string Emp1, string pass)
        {
            InitializeComponent();
            User = Emp1;
            Pass = pass;
        }

        public void Control1()
        {
            this.oldGoldToolStripMenuItem.Visible = false;

        }
        public string Emp
        {
            set
            {
                <big>this.txtemp.Text = value;
                this.aDMINISTRATIONToolStripMenuItem.Visible = false;
                this.reportsToolStripMenuItem.Visible = false;
                this.backUpToolStripMenuItem.Visible = false;
                this.accountsToolStripMenuItem.Visible = false;
               
                this.inventoryToolStripMenuItem1.Visible = true;
                this.stockEntryToolStripMenuItem1.Visible = true;
                this.stockReturnToolStripMenuItem1.Visible = true;
                this.salesToolStripMenuItem1.Visible = true;</big>
               
            }
        }


Controlling Form
C#
public partial class <big>frmDashBoard : Form</big>
    {

        public frmDashBoard()
        {
            InitializeComponent();
        }

        private void checkBox1_CheckedChanged(object sender, EventArgs e)
        {
            ///Here I have to type the code to control tool strip item in frmAdminIndex 

        }
    }
}




Nidheesh
Posted
Updated 28-Apr-13 7:51am
v3
Comments
ExpertITM 28-Apr-13 13:56pm    
just create object of frmAdminIndex and show it.

1 solution

The simplest way is to make the control public (far not the best practice however). See: http://msdn.microsoft.com/en-us/library/ms233630.aspx[^], and this image to find the property: http://brwiki.brulescorp.com/images/e/e7/CalendarProperties.JPG[^].

The best approach however is to add some public methods to your form and pass the necessary information there. This way every form can deal wit it's own stuff, and they don't interfere. And by the way you can use this also if you step forward to a multithreaded solution.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900