for example i have "NID" as textbox and datagrid with @NID field.
i want save NID with Value "N001" to @NID on datagrid.
how to prevent duplicate when i save NID with value "N001" to datagrid.

I trying like this but error :
Code:
private sub save()  
dim dgv as datagridview1  
if dgv.CurrentRow.Cells(0).value = NID.text then  
msgbox("Data duplicate")  
else  
dgv.rows.insert(.NewRowIndex, NID.text)  
end if  
end sub
help me
thanks