i am trying to call a function in Form1 from WPF window and i am getting the following error
“Reference to a non-shared member requires an object reference.”
also getting the same error when trying to access the Public variables in Form1 from wpf window.
is it not possiable to do it?
So according to the MSDN this error, this is a problem with trying to reference instance variables as if they are static.
If your class is
Form1, you cannot access methods or variables that are not static by callingForm1.Method(). This won’t work ever, not just in WPF. This is pretty basic stuff, you might want to read up more on VB. Check out Shared and Static documentation.To access, for example, the method
Show()on Form1, you must instantiate (create an instance of an object), and call the method on your object. Like this.