Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

System.NullReferenceException When transferring data

$
0
0

I have two windows open and I am trying to transfer text from a text box on page 1 to a password box on page 2. It's really baffling me, because it was working perfectly before and it's now giving me a System.NullReferenceException:

MainWindow mainWindow = Application.Current.MainWindow as MainWindow;
            mainWindow.passBox1.Password = this.genBox.Text;
            mainWindow.passBox2.Password = this.genBox.Text;


This is the error I receive:

An unhandled exception of type 'System.NullReferenceException' occurred in RS_Password_Protect.exe

Additional information: Object reference not set to an instance of an object.

-

Does anybody know what could be causing this? Like I said, it was working perfectly before, I just tried it and now it's giving me this error.

Thanks.


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>