What is the difference between ("") and (null)

c#, winforms

Solution

The same as the difference between `0` and an empty array: everything. They’re different values. `""` is an empty string, and that’s what a blank textbox holds as text is all. `null` is no value, and is not what a blank textbox has as `Text`.

Problem

While trying to set Validations i initially encountered some problems with checking if a textbox is null, i tried using ``` 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 this ``` 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 wasn't working. Thanks in advance

Original source