When trying to set checks, I first encountered some problems with checking if the text field is null, I tried to use
private void btnGo_Click(object sender, EventArgs e) { string name = textLogin.Text; if (name == null) { labelError.Visiblle = true; labelError.Text = "Field Cannot be Left Blank" } }
but it didn’t work until I tried it
private void btnGo_Click(object sender, EventArgs e) { string name = textLogin.Text; if (name == "") { labelError.Visiblle = true; labelError.Text = "Field Cannot be Left Blank" } }
My question is: I want to know the difference between ("") and (null) and why null did not work.
Thanks in advance
c # winforms
user2509901
source share