Thats always the danger of copying bits of code off the net .. there's not a lot in the code you've shown, and you dont say where that error is emitted from, so ....
...ok, assuming the error comes from
myCashDrawer.Open();
when you call OpenCashDrawer(), the most obvious thing, apart from it looking a bit messy design/implementation-wise, is I dont see anything that looks like
myCashDrawer = new CashDrawer();
possibly with arguments being passed into the instantiation of the CashDrawer Object