Let me explain my problem better, maybe it helps more.
I have this DialogBox, it works for me as a generic list selector for large lists of items (it has two listboxes side by side and buttons like "Add >>" and "<< Remove", and allows some smart text search with Regex).
It takes as arguments: a datatable which is the datasource, two strings that tell which fields are DisplayMember and ValueMember, and an array of Object() which represents those items which were previously selected. So each time the user presses a button that loads a given instance of this DialogBox, it sends this array in order to have the previous selections marked, so the DialogBox shows exactly how it did in the last time it was open for setup of those specific properties. So far, so good.
However, in spite of most of my datatables have Integer-typed primary key fields (the ValueMember), some few are Decimal-typed (because of big numbers involved) or even String-typed (because they are acronyms). Redesigning the database is out of question, so what to do? My first and only clue was assuming that an Object() parameter would hold seamlessly any underlying types whichsoever, but that doesn't seem to work this way. Is there anything I can do which is simpler that creating a battery of type-testing and iterative casting of elements? Thank you very much!