blah blah blah is here! blah blah » Close

up0down
link

I have a form called MainForm which has a toolStrip. When a button is pushed on the child form of MainForm I would like to hide/show certain toolStrip items. In the mainForm I would just add...
toolStripSettings.Visible = true;
but how can I call this same thing if I called it from childForm?
MainForm.toolStripSettings.Visible = true;
I get this error message
'BoxOffice.MainForm.toolStripSettings' is inaccessible due to its protection level

last answered 8 months ago

1 answers

up0down
link

i don't really got your idea but what about trying to use INTERFACES in your childforms so that what ever the value in the childform you changed, the mainform knows it.

up0down
link

BTW if it says protection level try to use public access to whatever was that.
eg.
public ObjectSetting value -------------or
public ObjectSetting GetSetting()
or
show us little bit of the code so we know what is wrong.

up0down
link

Basically the way the application works is it starts by opening MainForm which has a toolStrip. When they are ready to load a record, they click on a icon on the tollStrip added to MainForm. This opens a child called SubEvents with a dataGrid with all the events they have in the system. They click on the event they would like to view the details for, and SubEvents closes, opens SubEventInformation and changes the toolStrip of the MainApplication for different toolStripButtons to display.
Below is the exact code that I am trying to use
private void dataGridEvents_DoubleClick(object sender, EventArgs e)
{
inc_config.Application.EventID = dataGridEvents.Rows[dataGridEvents.CurrentRow.Index].Cells[0].Value.ToString();
inc_config.Application.EventName = dataGridEvents.Rows[dataGridEvents.CurrentRow.Index].Cells[1].Value.ToString();
inc_config.Application.EventDate = dataGridEvents.Rows[dataGridEvents.CurrentRow.Index].Cells[2].Value.ToString();
toolStripNewEvent.Visible = false;
toolStripEventInformation.Visible = true;
frmEventInformation frmSubEventInformation = new frmEventInformation();
frmSubEventInformation.MdiParent = frmMain.ActiveForm;
frmSubEventInformation.Show();
this.Close();
}

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback