Um.
The code you show does nothing: you create
pv
as a new collection:
List<ProductView> pv = new List<ProductView>();
You then immediately use it in a
foreach
loop:
foreach (var item in pv)
But because the collection is brand new, it's empty and the loop body is never entered. Which is actually a bonus, because if it did, it wouldn't work. Look at the body of your loop:
pv
can't be null - because you created a new collection immediately wearlier. You set the text box to the same text each time you go round the loop. You call ToString on an item which is (from it;s name) already a string. The text box shouldn't even be visible outside the new form itself, so unless you have changed it's declaration to
public
that code won;t compile - and if you have, that's a very bad idea: controls are
private
so that the inner workings of the form aren't exposed to the outside world and you can change it without messing the "outside world" at all.
In addition,
nf
is also created as a new form, but it's never shown - so even if you added items to it you wouldn't be able to see them.
To be honest, that looks like "panic code" - the type that gets thrown together when somebody doesn't think about what they are doing before attacking the keyboard. I'd strongly suggest you think about what you are doing for a while, then scrap this and start again.