There are web apps which can do the conversion for you, such as
Telerik Code Converter[
^], which gives the following VB.NET code:
Dim Found As Boolean = False
If dataGridView.Rows.Count > 0 Then
For Each row As DataGridViewRow In dataGridView.Rows
If Convert.ToString(row.Cells(0).Value) = textBox_ProductId.Text AndAlso Convert.ToString(row.Cells(1).Value) = textBox_Price.Text Then
row.Cells(2).Value = Convert.ToString(1 + Convert.ToInt16(row.Cells(2).Value))
Found = True
End If
Next
If Not Found Then
dataGridView.Rows.Add(textBox_ProductId.Text, textBox_Price.Text, 1)
End If
Else
dataGridView.Rows.Add(textBox_ProductId.Text, textBox_Price.Text, 1)
End If