Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everybody,

I have a problem with the next programme, when I try to retrieve the data in the variable recordsCollection, i get this error:

Error 1 Expression is of type 'JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecordsCollection', which is not a collection type

The problem out in this part:
VB
For Each record As JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecord In recordsCollection

more precisely in recordsCollection
Here is the program:
VB
Private Sub ButtonDecharger_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonDecharger.Click


       numSerieSonde = TextBoxNumSerie.Text
       CaptSonde = typeSonde + TextBoxNumSerie.Text
       Dim monitoring As New Monitoring()

       SpyModem.GetSatelliteMeasurementsFromLast(CaptSonde, 1, Data1)

       Dim converter As New JRI.Systeme.Data.SpyRf.Records.RecordsDataToRecordsCollectionConverter(Monitoring)
       Dim recordsCollection As JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecordsCollection = Converter.convert(Data1)



       For Each record As JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecord In recordsCollection
           If record.recordType = JRI.Systeme.Interfaces.Devices.SpyRf.Records.RecordType.TrackMeasure Then
               Dim recordMeasure As JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecordMeasure = TryCast(record, JRI.Systeme.Interfaces.Devices.SpyRf.Records.IRecordMeasure)
               Console.WriteLine("{0} : Mesure {1}", record.dateTime, recordMeasure.measure.intValue / Math.Pow(10, recordMeasure.monitoring.numOfDecimals))
           Else
               Console.WriteLine("{0} : {1}", record.dateTime, record.recordType)
           End If
       Next


   End Sub

What is the problem?
Thanks
Posted
Comments
Jameel VM 3-Sep-13 12:11pm    
can you post the interface code and data1 details

1 solution

Its telling you that the IRecordsCollection (the recordsCollection variable) despite its name is not a collection, which also means that For Each can't iterate through it. It might behave like a collection, but it doesn't derive from a collection class that For Each can iterate through.

I would look up the inheritance chain for the IRecordsCollection and make sure it derives from one of the built in collection classes. Is this something you wrote or something that you got somewhere else?
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900