i cant seem to get either of these two vb6 commands correctly

VB Code:
  1. dim i as popbox
  2. for each i in frmmain ' where frmmain is the form i am on
  3.   'do something with object here
  4. next i
  5.  
  6.  
  7. ' and
  8. dim i as object
  9. for each i as popbox ' where popbox is a usercontroll in the current form
  10.   'do something with object here
  11. next i

so what is the proper Vb.net way to loop through a certain kind of object and do something with it?