Click here to Skip to main content
15,949,686 members
Please Sign up or sign in to vote.
2.50/5 (2 votes)
good morning

I have two class
1-class Window1 : that contains the tab control added
2-class DesignerCanvas :must add a text in tab control
I then add the following code in the class DesignerCanvas
public  Window1 form;
      public  DesignerCanvas(Window1 form)
 {
     this.form = form;
 }
   public void SendBackward_Executed( object sender, ExecutedRoutedEventArgs e)
     {
         ((Window1)form).tabItem1.Content = "new text"  ;
     }


In class window1 I add the following code
private DesignerCanvas test = new DesignerCanvas();

and in the method public window1 I add:
public Window1()
       {
           InitializeComponent();
           test.form = this;
         //here is the error
           test.SendBackward_Executed(object sender , System.Windows.Input.ExecutedRoutedEventArgs e);

       }

is there any other way to call the method??
Posted
Updated 11-Jan-13 0:29am
v2

1 solution

Even the first two lines of code won't compile, due to some code garbage in a very first line. Remove gibberish from the code and then ask a question. But there are no any hassles to call anything from "other class": it's just the matter of access modifiers and, more importantly, proper design of the code.

—SA
 
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