You can do this in many ways, my experience with DataGridView I do as follows.
Suppose you have a model class for your dataGridView
public class MyBarcodeRow
{
private String barcode = String.Empty;
public String Barcode
{
get { return barcode; }
set {
barcode = value;
////TODO OPERATION ON OTHER FIELD
//FOR EXAMPLE GET DATA OF QUANTITY FROM DATABASE
this.Quantity = new Random().Next(Int32.MaxValue);
}
}
private int quantity = 0;
public int Quantity
{
get { return quantity; }
set { quantity = value; }
}
//AND OTHER FIELD
}
In your form drag a BindingSource and associated it
BindingSource.DataSource = MyBarcodeRow
Now when you insert the barcode and leave cells you can load other data values.

From experience I suggest you focus on the events of the BindingSource and the Get / Set methods of the class of model that uses the VIEW.
Then there are also many interesting events in the grid, however, these structures work best when used from this point of view