Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Looking for Class & Collection Design Tip...

Status
Not open for further replies.

Interwizard

Programmer
Nov 9, 2001
18
US
Hi All! I'm a little new to implementing Classes that emulate business objects and I wanted to see if I could get some advice. I'm working on a barcoding app. Barcode input comes from a keyboard wedge and is essentially interpreted as keyboard input.

I was hoping to have the form capture all keystrokes with the keypreview property turned on and then use keypress. Peice of cake, works like a charm.

The end of a barcode is signified with the Pipe (|) Character. Obviously I can do what I'm wanting with arrays or even a few user defined data types, but I want to be a good little egg-head and actually make this portion into classes.

I created a character class to have properties signifying the character code and the character itself.
I created a collection of these characters..
Now, I would like to have the class look at the value everytime the character collection is written to, and then, essentially enumerate ( for each, next ) through the collection of characters, adding to a second collection of "barcode number" classes.

I hope this isn't too abstract. Essentially.. A collection of characters needs to detect the pipe and add to the collection of "barcode labels" .
So, how do I relate the two classes to one another to accomplish this?

Thanks!
Bill Dodd
 
Assuming you're using a custom collection class, how about raising an Event when you hit a pipe? Then the procedure that's adding characters will know that it's time to pump the completed barcode off to the labels.

Alternatively, why collect the characters in a separate class? Why not use your barcode label class instead. When the pipe's hit, the label nows it's complete and a custom property can expose that completeness attribute. So when you start to capture a barcode, you create a new label object and start assigning characters until it's complete or some other event stops it. You may choose not to store incomplete labels in the collection, depends what you do with those...

HTH,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top