Hello I have a WPF/C# application with 2 windows.
I am trying to access a
public int myInt;
in my MainWindow from my OtherWindow:
MainWindow.myInt =3;
intellisense wont even allow me to access the variable.
Could someone please help?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to declare it as
staticas you don’t access it via an instance, but via class name. That said, it is usually not considered good design to expose fields publicly.