Click here to Skip to main content
12,507,433 members (68,328 online)
Rate this:
 
Please Sign up or sign in to vote.
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 11-Jan-13 0:15am
Updated 11-Jan-13 0:29am
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

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
  Permalink  

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160927.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100