Forum General


The Xamarin Forums have officially moved to the new Microsoft Q&A experience. Microsoft Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

To create new threads and ask questions head over to Microsoft Q&A for .NET and get involved today.

Object reference not set to an instance of an object

syshynesyshyne Member
edited February 2020 in General

I'm new to Xamarin, and I'm currently trying at designing a login page, I have a line of code that tests if my entries are empty or not,
but it always throws me the same "System.NullReferenceException" and I dunno why,
here's the code, and this method is in the ** login.xaml.cs ** file, while the entries are in the login.xaml file

public void LoginMethod(object s, EventArgs e) { if (EntryUserName.Text.Equals("") || EntryPassword.Text.Equals("")) { DisplayAlert("Error", "Fill all fields", "okay"); } else { if (!EntryUserName.Text.Contains("@")) { DisplayAlert("Error", "The E-mail address entered isn't valid", "okay"); } } }

Sign In or Register to comment.