Click here to Skip to main content
Sign Up to vote bad
good
See more: C#WPFVS2010
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:15
Edited 11 Jan '13 - 0:29


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
  Permalink  

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

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 OriginalGriff 343
1 Sergey Alexandrovich Kryukov 138
2 Mohammed Hameed 123
3 Santhosh G_ 113
4 Ron Beyer 84
0 Sergey Alexandrovich Kryukov 8,266
1 OriginalGriff 6,516
2 CPallini 3,533
3 Rohan Leuva 2,703
4 Maciej Los 2,234


Advertise | Privacy | Mobile
Web04 | 2.6.130516.1 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid