i want them to load into the same listview with the same subroutine(sub sFillListview(c as collection)) or something like that.
Prefereble with headers.
Like you can see picture 1 has only 2 columns but picture 2 has 23
Your classes have nothing in common, so your "single method to do it all" idea won't work. So, how is your "one method to rule them all" supposed to know how to handle each different class passed in the parameters?
Are you looking to take the data from these classes and format it somehow to be added to a ListView? If that's the case, you have to add something to these classes to give something in common. Create an Interface that both of these classes implements so each class can supply code to format itself to be used in a ListView:
Function ListViewFormat() AsStringEndInterface
Now, each class has to implement the interface and supply the code for the ListViewFormat method.
Then you can change your List to be a collection of IListViewFormat and pass that to your method that adds the items to a ListView.
Dim collection = New List(Of IListViewFormat)
... add your items to the List and pass it to the method
PublicSub AddToListView(ByVal collection As IList(Of IListViewFormat))
ForEach item In collection
Seems that there is no direct solution. I have added another function that return a simple collection.
In item 1 I return fieldnames, fieldtypes and fieldsizes. The other items contains the real elements.
The suggestion of Dave is the direct Solution ...
If your classes have nothing in common you have to create something. This could be an interface.
Now you are able (by reflection) to detect those classes which have this interface and put them (or a content from them) into a List.
I have a requirement where I need to design a code of an application for the Master Slave communication via serial ports.I got the idea how to send and read data via serial ports in VB
but i got stuck about how to code the logic so that Master will throw data packet over the channel
and it will be listening to all the slaves but data will be actually received by the particular slave which Slave ID is mentioned and ignored by the all other Slaves.
Really? A label has no way of limiting what is put into its Text property. You have call ToString on the value you're displaying and provide the number format string to limit the result to 3 places while formatting everything to the left of the decimal to whatever specification you want.
As Dave allready has written ...
But there is another possibility :
You create your own (customized) AnalogueLabel which derives from Label and has a Property 'Value' which type is for example single (or double).
If a legal value is assigned to this Property you can assign it to the Text-Property with the rerquired formatting :