if ( dgvPizza.Rows.Count!=0)
This is pointless. If the count is 0, your loop would not run.
You need to tell us what line gives you an error, and try using some punctuation so your post is readable. IF you use the SelectedItem property on the control, you can look at just the selected row. It is null only if nothing is selected, you should check for that.
Don't post the code that works, post the code that does not work, so we can see what is going wrong.