VB.Net: Querying a FaxJob

  • Thread starter Thread starter Torben Frandsen
  • Start date Start date
T

Torben Frandsen

Hi

In a VB.Net app I'm trying to enumerate the FaxJobs collection in order to
query individual fax jobs. This is my code:


Dim Jobs As FAXCOMLib.FaxJobs
Dim CurrentJob As FAXCOMLib.FaxJob

Jobs = CType(Server.GetJobs, FAXCOMLib.FaxJobs)

For i As Integer = 0 To Jobs.Count - 1
CurrentJob = CType(Jobs.Item(i), FAXCOMLib.FaxJob)
' Continue to do stuff with CurrentJob
Next

While the Object type returned by Server.GetJobs casts nicely to a FaxJobs,
the latter cast fails with message: Cannot convert to 'Interface FaxJob'.
Why is that and what can I do about it?

Torben
 
When you enumerate throught the FaxJobs collection you have to start with an
index of 1 and not 0. So your loop should look as follows:-

For i As Integer = 1 To Jobs.Count
CurrentJob = CType(Jobs.Item(i), FAXCOMLib.FaxJob)
' Continue to do stuff with CurrentJob
Next


--
Chandrasekar R

Microsoft Printing, Imaging and Fax Team

This posting is provided "AS IS" with no warranties, and confers no rights.

Please do not send email directly to this alias. This alias is for newsgroup
purposes only.
 
Chandrasekar said:
When you enumerate throught the FaxJobs collection you have to start
with an index of 1 and not 0. So your loop should look as follows:-

For i As Integer = 1 To Jobs.Count
CurrentJob = CType(Jobs.Item(i), FAXCOMLib.FaxJob)
' Continue to do stuff with CurrentJob
Next

I'll just move the keyboard a bit and make room for my forehead on the desk
:-)

Thanks a bunch, Chandrasekar!

Torben
 
Back
Top