VB.Net: Querying a FaxJob

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
 
C

Chandrasekar [MSFT]

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.
 
T

Torben Frandsen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top