title: Check if TextBox is empty and return MessageBox?
body: <p>I made this statement to check if TextBox is empty, but the MessageBox always shows up 
  wether the TextBox is empty or not.</p>
  
  <pre><code>    private void NextButton_Click(object sender, EventArgs e)
      {
          decimal MarkPoints, x, y;
          x = HoursNumericUpDown.Value;
          y = MarkNumericUpDown.Value;
          MarkPoints = x * y;
  
          //decimal MarkPoints = (decimal)HoursNumericUpDown.Value * (decimal)HoursNumericUpDown.Value;
  
  
          DataGridViewRow dgvRow = new DataGridViewRow();
          DataGridViewTextBoxCell dgvCell =  new DataGridViewTextBoxCell();
  
          dgvCell = new DataGridViewTextBoxCell();
          dgvCell.Value = MaterialTextBox.Text;
          dgvRow.Cells.Add(dgvCell);
  
          dgvCell = new DataGridViewTextBoxCell();
          dgvCell.Value = HoursNumericUpDown.Value;
          dgvRow.Cells.Add(dgvCell);
  
          dgvCell = new DataGridViewTextBoxCell();
          dgvCell.Value = MarkNumericUpDown.Value;
          dgvRow.Cells.Add(dgvCell);
  
          dgvCell = new DataGridViewTextBoxCell();
          dgvCell.Value = MarkPoints;
          dgvRow.Cells.Add(dgvCell);
  
          dataGridView1.Rows.Add(dgvRow);
  
          MaterialTextBox.Clear();
          HoursNumericUpDown.Value = HoursNumericUpDown.Minimum;
          MarkNumericUpDown.Value = MarkNumericUpDown.Minimum;
  
          if (String.IsNullOrEmpty(MaterialTextBox.Text))
          {
              MessageBox.Show("Enter Material Name Please.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
              //dataGridView1.Rows.Clear();
          }
          else
          {
              /*if (MarkNumericUpDown.Value &lt; 50)
              {
                  int index = dataGridView1.Rows.Add();
                  dataGridView1.Rows[1].Cells[4].Value = "F";
              }
              else if (MarkNumericUpDown.Value &gt; 50 &amp;&amp; MarkNumericUpDown.Value &lt;= 64)
              {
                  dataGridView1.Rows[index].Cells[4].Value = "F";
              }*/
  </code></pre>