Calling function in a child window from main parent window

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jan 2006
Posts: 26
Reputation: daidaiboyboy is an unknown quantity at this point 
Solved Threads: 0
daidaiboyboy daidaiboyboy is offline Offline
Light Poster

Calling function in a child window from main parent window

 
0
  #1
Mar 12th, 2006
Hi all...

This is the case:

I have a main parent window, and a child window inside it.
The parent window consists of a menubar, whereby clicking one of its menu item (mnuSave) is supposed to save the graph drawn inside the child window. The code for saving the graph is done by a method called SaveGraph(). I tried calling the method from the main parent window, but then an error occured saying "TestProg.ChildWin.zedGraphControl1" denotes a 'field' where a 'class' was expected.

The following illustrates better :

Inside parent window (TestProg)

  1. private void mnuSave_Click(object sender, System.EventArgs e)
  2. {
  3. ChildWin selectedView = (ChildWin)this.ActiveMdiChild;
  4. ChildWin.SaveGraph();
  5. }

Inside the child window (ChildWin)

  1. public static void SaveGraph()
  2. {
  3. zedGraphControl1.GraphPane.Image.Save(@"\My Documents\Visual Studio Projects\image.png", System.Drawing.Imaging.ImageFormat.Png);
  4. }

The zedGraphControl1 is one drawing graph control from zedGraph, a useful graph drawing plugin for C#. What should I do in this case?
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC