change it to be
private void iTEM_NUMTextBox_Leave(object sender, EventArgs e)
{
if (this.gmL_ITEMMSTRTableAdapter1.GetDataBy__StockNumber(iTEM_NUMTextBox.Text).Rows.Count> 0)
{
this.iM_IDTextBox.Text = this.gmL_ITEMMSTRTableAdapter1.GetDataBy__StockNumber(iTEM_NUMTextBox.Text).Rows[0]["ID"].ToString();
}
}
or simply you can put it in a try catch statment like:
private void iTEM_NUMTextBox_Leave(object sender, EventArgs e)
{
try
{
this.iM_IDTextBox.Text = this.gmL_ITEMMSTRTableAdapter1.GetDataBy__StockNumber(iTEM_NUMTextBox.Text).Rows[0]["ID"].ToString();
}
catch
{
}
}