TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Andrew
NA
17
0
MDI Child form interacting with its MDI Parents Controls - how?
Nov 23 2008 3:17 PM
Situation:
I have a MDI Parent which has a Treeview of data loaded at form_load event.
Clicking certain nodes of this Treeview opens a child form named 'Companies'. In Companies I display a datagrid. Double clicking on rows should change the Treenode that is selected in my MDI Parent (the childs parent).
However, I am getting a System.StackOverflowException when I double click on a DataGridRow.
Here is the Event handler
[code]
private void dgCompanies_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
{
selectedCompany = dgCompanies.SelectedCells[0].Value.ToString().Trim();
frmMain newFrmMain = (frmMain)this.MdiParent;
newFrmMain.JumpToCompany(selectedCompany);
}
[/code]
And here is JumpToCompany which is a public event in frmMain
[code]
public void JumpToCompany(string companyName)
{
try
{
foreach (TreeNode treeNode in this.trvCompanyVesselList.Nodes)
{
if (treeNode.Tag.ToString() == companyName)
{
trvCompanyVesselList.SelectedNode = treeNode;
trvCompanyVesselList.Focus();
foundIndex = true;
}
JumpToCompany(companyName);
}
}
catch (StackOverflowException se)
{
MessageBox.Show(se.Message);
}
}
[/code]
So, in a nutshell, can I interact with controls on a MDI Parent form, which is triggered by an event on a Child form?
Cheers
Reply
Answers (
0
)
icon
please solve this error