Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# WPF VS2010
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()
            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
Edited 11-Jan-13 0:29am

1 solution

Rate this: bad
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.

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

  Print Answers RSS
0 OriginalGriff 373
1 Sergey Alexandrovich Kryukov 197
2 Richard Deeming 160
3 PhilLenoir 120
4 RyanDev 115
0 Sergey Alexandrovich Kryukov 6,405
1 OriginalGriff 5,798
2 CPallini 2,473
3 Richard MacCutchan 1,647
4 Abhinav S 1,530

Advertise | Privacy | Mobile
Web03 | 2.8.140821.2 | Last Updated 11 Jan 2013
Copyright © CodeProject, 1999-2014
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