What did I do wrong (VB.NET)

  • Thread starter Thread starter Bill Nguyen
  • Start date Start date
B

Bill Nguyen

please tell me what I am missing in the snippet below:
Dim fxServer As New FaxServer

Dim fxDoc As New FaxDocument

Dim fxID As Integer

fxDoc = CreateObject("FAXCOMEX.FaxDocument")

'Set file name of document.

Try

fxDoc.Body = "C:\dotnet\gartner.doc" 'Send this document- Give a valid path
'***MUST***

fxDoc.DocumentName = "Test Fax"

fxDoc.Recipients.Add("9999999") 'Sending Number ' Must '9 for prefix in my
case.

'Set the sender properties.

fxDoc.Sender.Name = "Bill "

fxDoc.Sender.FaxNumber = "9999999" 'Put a valid number to avoid error

'

'Submit the document to the connected fax server and get back the job ID.

' fxID = fxDoc.Submit("printserver") 'Fax server name Regent which can be a
remote server.

'------------------------

fxDoc = Nothing

fxServer = Nothing

Catch

Dim ex As Exception

MsgBox(ex.ToString)

End Try

Exit Function
 
I don't see a problem as such. What's the error (or exception) code you are
getting?

--
Raghavendra 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.'
 
Alex;
I'm connecting to a Win 2003 fax server named "PRINTSERVER"
How can the app get connected if the fax server name is empty?
Thanks
Bill
 
Sorry, did not notice that. In that case yes, use it's name as a parameter
to Connect. Also, what is the client OS?
 
Alex;
The client OS is XP professional SP2. This is my development machine. I
already installed the shared fax from fax server "Printserver"

I tried fxServer.Connect("Printserver") but it seemed not to be working.

Anyadd itional info you want me to post for debugging?
Thanks

Bill
 
Do you get an error code returned from any of this calls (Connect,
ConnectredSubmit)?
 
Alex;
here's what happened:

Error msg:
An unhandled exception of type 'System.NullReferenceException' occurred in
App.exe
Addtional Information: Object reference not set to an instance of an object.


During execution, I noted that:
fxServer.Connect("PRINTSERVER") showed nothing

fxDoc.Recipients.Add("9,3938738") showed nothing

fxID = fxDoc.Submit("printserver") -> this line caused the error above to
occur


Hope that this give you some idea.



Thanks



Bill
 
Bill,
Every method on the COM object such as FaxServer or FaxDocument returns
HRESULT - a 32 bit value. If it is not 0, then an error has occured and
HRESULT is an indication of this error. What error do you get here?
 
Alex;
it was the problem with the document file/path name.
fxDoc.Body = "C:\dotnet\gartner.doc". Should be gartner2004.doc instead.
it's working good now.
Thanks for your help.
Bill
 
Back
Top