title: prevent duplicate record being enter in DataGridView
body: <p>Process is as follow</p>
  
  <p>Entering record from textboxs to datagridview and then to database</p>
  
  <p>when enter data into textbox and fire the click event of <strong>Enter the data into datagridview button</strong></p>
  
  <p>constraint check is that ID being enter. Is already exist or not..? the code for that is </p>
  
  <pre><code>For i = 0 To DataGridView1.Rows.Count - 1
          If txt_id.Text = DataGridView1.Rows(i).Cells("id").Value.ToString Then
              MessageBox.Show("record already exist")
          End If
      Next
  </code></pre>
  
  <p><strong>butt it throw an exception</strong>  NullReferenceException </p>
  
  <p><strong>why</strong> when at first time it checks there is no record in <strong>row(i).cells("id")</strong></p>
  
  <p>How tackle this problem.....?</p>