Link to home
Start Free TrialLog in
Avatar of arvindb1
arvindb1

asked on

Print HTML documents from VB.NET Windows application

Hi

Can somebody pls. tell me how to print HTML documents from VB.NET Windows application WITHOUT GETTING PRINT DIALOG BOX .
I have two problems
One is how to read HTML document using VB.NET windows application i.e. if i want to read value from an Input Text box from an HTML document then how to read it
Secondly how to print html docs without getting print dialog box control, basically i'm using WebBrowser control to load and view but i want to know hot to read and print.
I tried with Window.Print in this but it always gives me Print dialog box.
Pls. Help

Arvind
ASKER CERTIFIED SOLUTION
Avatar of testn
testn

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of arvindb1
arvindb1

ASKER

1. I tried like this
            Dim doc As New mshtml.HTMLDocument
            doc.open("f:\temp\abc.htm")
            Dim textstr As String = doc.all.txtfirst.value

But gets the error-- couldnt find element (txtfirst is a textbox in my htm file)
Is this the way to load document without using Webbrowser, i need to load htmldocument to read without using webbrowser

2. I used it using WebBrowser only and gets this error--- trying to revoke a drop target that has not been registered.

Arvind
I tried first one with WebBrowser also but it gives error Object Reference not set to an instance of an object at Dim textstr As String = doc.all.txtfirst.value

Second problem i got some solution like this
        AxWebBrowser1.Navigate("F:\Help\testwinapp\test\abc.htm")
        While AxWebBrowser1.QueryStatusWB(SHDocVw.OLECMDID.OLECMDID_PRINT) <> SHDocVw.OLECMDF.OLECMDF_SUPPORTED + SHDocVw.OLECMDF.OLECMDF_ENABLED
            Application.DoEvents()
        End While
        AxWebBrowser1.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT, SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER)

then i'm able to print without prompt.
but first problem still remains.
Thanks a lot
Arvind
Hi Testn

Now the problem in printing is that if i put this into loop and try to print many html documents then i'm able to print only one document and rest all prints gets abondoned, any  way to control this??

Second problem still remains, i'm not able to read values from html after loading.
Pls. help
Arvind
Hi Testn

Points are all yours if you just help me in this.
I want to read a preformatted mail (you can even suggest what format shall i use), currently i'm thinking about HTML format which has got some fields filled up and i want to read this mail programmatically and fetch the values from different fields and enter into the database. I'll accept any possible solution which can solve this problem.

Actually the flow is -- i will send a formatted mail to users who will fill up the fields in the mail itself while replying and then i have to fetch those values from mail and update the database.
Pls. suggest, how to acheive this minimizing the possibility of errors.

Thanks
Arvind Bansal

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi testn
i tried that but it still prints one page only, anyway other part is OK.
Thanks for your help. I'm awarding you the points as i dont see any more comments coming out to solve this. Anyway thanks a lot.
Arvind