Click here to Skip to main content
15,905,229 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: New SDK for visual studio projects Pin
Not Active18-Mar-11 10:12
mentorNot Active18-Mar-11 10:12 
GeneralRe: New SDK for visual studio projects Pin
Richard MacCutchan18-Mar-11 10:45
mveRichard MacCutchan18-Mar-11 10:45 
GeneralRe: New SDK for visual studio projects Pin
rodrigogroff18-Mar-11 11:00
rodrigogroff18-Mar-11 11:00 
AnswerRe: New SDK for visual studio projects Pin
PIEBALDconsult18-Mar-11 19:15
mvePIEBALDconsult18-Mar-11 19:15 
QuestionSSH for File transfer Pin
byka16-Mar-11 1:53
byka16-Mar-11 1:53 
AnswerRe: SSH for File transfer Pin
Rick Shaub16-Mar-11 7:05
Rick Shaub16-Mar-11 7:05 
QuestionProblem with MSER extracting Pin
thematteo16-Mar-11 0:53
thematteo16-Mar-11 0:53 
Questioncommunication between 2 windows Pin
Defender-NF14-Mar-11 7:59
Defender-NF14-Mar-11 7:59 
hello

i have in my application 2 windows, mainwindow and window2, in window2 there is a bool variable and its false per default, after clicking a button in windows 2 it becomes true and another function in the mainwindow start and should change a buttoncontent in the mainwindow if the variable of windows is true..
the problem is the mainwindow class doesnt get the changing of the variable of window2 and still thinks its false and also the content isnt changing

here is the code of the mainwindow:
public partial class MainWindow : Window
   {
       public MainWindow()
       {
           InitializeComponent();
       }
       public Window2 window2instance2 { get; set; }



       public void ChangeButton1Content()

       {



        if (window2instance2.key)
           {
               Button1.Content = "I Changed";

           }
       }

       private void Openwindows2_Click(object sender, RoutedEventArgs e)
       {
           Window2 window2instance = new Window2();
           window2instance.MainWindowInstance = this;
           window2instance.Show();

       }

   }


and this is the codebehind of window2:
public partial class Window2 : Window
{
    public Window2()
    {
        InitializeComponent();
    }

    public bool key = false;
    public MainWindow MainWindowInstance { get; set; }


   public void window2button_Click(object sender, RoutedEventArgs e)
    {
         MainWindow mainwindow = new MainWindow();
        mainwindow.window2instance2 = this;
        key = true;


        MainWindowInstance.ChangeButton1Content();

        this.Close();
    }
}


this was my last try and compiler is telling me at " if (window2instance2.key)" that Object reference not set to an instance of an object.
any tipps how can i resolve that?

thanks and cheers
AnswerRe: communication between 2 windows Pin
Pete O'Hanlon14-Mar-11 8:09
mvePete O'Hanlon14-Mar-11 8:09 
GeneralRe: communication between 2 windows Pin
Defender-NF14-Mar-11 8:14
Defender-NF14-Mar-11 8:14 
GeneralRe: communication between 2 windows Pin
Pete O'Hanlon14-Mar-11 10:24
mvePete O'Hanlon14-Mar-11 10:24 
AnswerRe: communication between 2 windows [modified] Pin
RobCroll14-Mar-11 12:20
RobCroll14-Mar-11 12:20 
GeneralRe: communication between 2 windows Pin
Defender-NF15-Mar-11 2:31
Defender-NF15-Mar-11 2:31 
GeneralRe: communication between 2 windows Pin
Pete O'Hanlon15-Mar-11 3:00
mvePete O'Hanlon15-Mar-11 3:00 
QuestionUnknown error mapping drive. Return result=1208 Pin
byka14-Mar-11 2:48
byka14-Mar-11 2:48 
AnswerRe: Unknown error mapping drive. Return result=1208 Pin
Luc Pattyn14-Mar-11 3:07
sitebuilderLuc Pattyn14-Mar-11 3:07 
AnswerRe: Unknown error mapping drive. Return result=1208 Pin
englebart16-Mar-11 1:47
professionalenglebart16-Mar-11 1:47 
QuestionConnecting Lex generated code with VC++.NET Pin
nautiyal.sudhanshu10-Mar-11 8:01
nautiyal.sudhanshu10-Mar-11 8:01 
AnswerRe: Connecting Lex generated code with VC++.NET Pin
Rob Grainger25-Mar-11 5:25
Rob Grainger25-Mar-11 5:25 
QuestionHow i can get the Device driver information in .net4.0 Pin
wasimsharp10-Mar-11 4:05
wasimsharp10-Mar-11 4:05 
Answerrepost alert Pin
Luc Pattyn10-Mar-11 4:08
sitebuilderLuc Pattyn10-Mar-11 4:08 
Questionvoice recognition Pin
baadsah.499-Mar-11 5:33
baadsah.499-Mar-11 5:33 
AnswerRe: voice recognition Pin
Pete O'Hanlon9-Mar-11 7:15
mvePete O'Hanlon9-Mar-11 7:15 
AnswerRe: voice recognition Pin
Abhinav S9-Mar-11 17:55
Abhinav S9-Mar-11 17:55 
QuestionRegularExpressions.Regex Pin
byka9-Mar-11 1:52
byka9-Mar-11 1:52 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.