473,511 Members | 13,105 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use WebBrowser (vb) to show various kinds of file?

I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since those
kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.


Jan 29 '07 #1
12 5976
I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
>I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.


Jan 29 '07 #2
Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for viewing
such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none׫Œ‘ì¶à]¼þЄ:Bo******************************@comcast.co m...
>I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
>>I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.



Jan 29 '07 #3
I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for viewing
such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none׫Œ‘ì¶à]¼þЄ:Bo******************************@comcast.co m...
>>I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
>>>I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.




Jan 29 '07 #4
Thank you very much.
Benson

"RobinS" <Ro****@NoSpam.yah.none׫Œ‘ì¶à]¼þЄ:Rd******************************@comcast.co m...
>I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
>Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for viewing
such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none׫Œ‘ì¶à]¼þЄ:Bo******************************@comcast.co m...
>>>I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.




Jan 29 '07 #5
Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Rd******************************@comcast.com. ..
>I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
>Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for viewing
such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none>
׫O'ì¶à]¼þÐÂÂ":Bo******************************@comcast.co m...
>>>I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you tried
that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
I want to write a program to display files (xls, doc,html,pdf,jpg) on
screen. I thought I can use WebBrowser in VB2005 to do this job since
those kinds of files can be displayed in IE.

I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??

Thanks advance.
Benson.




Jan 29 '07 #6
>I don't think you can view Excel or Word files w/o having those programs
>installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.
yes, and normally it's easier just to call the file, which opens the
assiciated program automatically (could be openOffice?)
But anyway:
If you want to show anything in the browser, it must know the mime-type to
be able to correctly do this and load the correct plugin.

Greetings,
Dirk


Jan 29 '07 #7
Yes, you're right! Good one!

Robin S.
--------------------------
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:nN******************************@comcast.com. ..
Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Rd******************************@comcast.com. ..
>>I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
>>Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for
viewing such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none>
׫O'ì¶à]¼þÐÂÂ":Bo******************************@comcast.co m...
I think most people use Process.Start and pass in the file name, and
Windows figures out what program to use to open the file. Have you
tried that?

Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl...
>I want to write a program to display files (xls, doc,html,pdf,jpg) on
>screen. I thought I can use WebBrowser in VB2005 to do this job since
>those kinds of files can be displayed in IE.
>
I try to use the following code, but FAIL:
Dim fs As FileStream
fs = File.OpenRead("D:\doc\joblist.xls")
WebBrowserMsg.DocumentStream = fs
==>show binary data, not Excel data
>
I also try:
WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
==seems to work, but with a "save or open dialog box shown" (HOW TO
SUPRESS IT to alwasys open)?
==Is it right to use this method??
>
Thanks advance.
Benson.
>
>
>
>




Jan 29 '07 #8
webbrowser control works great.. i use those in Access forms _ALL_ the
time.
Insert, ActiveX control.

you see; Robin doesn't understand when / where people use the Office
Web Components.

the main reason I say 'screw DOTNET' is because they don't have
anything as powerful as OWC

I mean.. VS 2002 and 2003 didn't even support the WebBrowser control..
right?

That's LAUGHABLE. There was a simple wizard for using it in VB6.
it always makes me laugh when I find things that are really really
really easy to do inside of VB6 or Access.. and this new DOTNET _CRAP_
can't do it

it's like.. what kind of fucking idiot would try to sell us on a
platform that was _LESS_POWERFUL_?

I mean seriously here; do these people know how to read plain
english??

-Aaron

Jan 30 '07 #9
Thanks Robin.... ya know... sometimes I just can't STAND it when I have a
flash of brilliance... ROFL

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:7M******************************@comcast.com. ..
Yes, you're right! Good one!

Robin S.
--------------------------
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:nN******************************@comcast.com. ..
>Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:Rd******************************@comcast.com ...
>>>I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

Good luck; let me know how it goes.
Robin S.
------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:O9**************@TK2MSFTNGP04.phx.gbl...
Yes. I know this function and I think it should work. But I hope my
application has the following addition features:
1. Open the file inside my application eg. inside a panel
2. Hope user need not install any Excel, Word or pdf programs for
viewing such files inside my application.

Any further suggestion? If no, I use what Robin has suggested.
Thanks.
Benson.

"RobinS" <Ro****@NoSpam.yah.none>
׫O'ì¶à]¼þÐÂÂ":Bo******************************@comcast.co m...
>I think most people use Process.Start and pass in the file name, and
>Windows figures out what program to use to open the file. Have you
>tried that?
>
Robin S.
------------------------------------------
"Benson" <be*******@yahoo.com.hkwrote in message
news:eH**************@TK2MSFTNGP02.phx.gbl.. .
>>I want to write a program to display files (xls, doc,html,pdf,jpg) on
>>screen. I thought I can use WebBrowser in VB2005 to do this job since
>>those kinds of files can be displayed in IE.
>>
>I try to use the following code, but FAIL:
>Dim fs As FileStream
>fs = File.OpenRead("D:\doc\joblist.xls")
>WebBrowserMsg.DocumentStream = fs
>==>show binary data, not Excel data
>>
>I also try:
>WebBrowserMsg.Url = New Uri("d:\doc\joblist.xls")
>==seems to work, but with a "save or open dialog box shown" (HOW TO
>SUPRESS IT to alwasys open)?
>==Is it right to use this method??
>>
>Thanks advance.
>Benson.
>>
>>
>>
>>
>
>




Jan 30 '07 #10
Dirk,

Thanks for the heads-up. :)

Bruce

"msdnuniv" <nb@nowhere123.comwrote in message
news:Oe**************@TK2MSFTNGP03.phx.gbl...
I don't think you can view Excel or Word files w/o having those programs
installed, unless there is a viewer available and it's installed. (I know
there's one for Excel, but I don't know about Word.) I'm not sure you can
even open Office files in IE unless you have the Office software.

As for pdf, you just need Acrobat, and it's free and most people have
that.

yes, and normally it's easier just to call the file, which opens the
assiciated program automatically (could be openOffice?)
But anyway:
If you want to show anything in the browser, it must know the mime-type to
be able to correctly do this and load the correct plugin.

Greetings,
Dirk


Jan 30 '07 #11
RobinS schreef:
Yes, you're right! Good one!

Robin S.
--------------------------
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:nN******************************@comcast.com. ..
>Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce

That's only if you're not using some fancy stuff. And does wordpad open
docs from the latest incarnations of office?

Rinze
Jan 30 '07 #12

"C-Services Holland b.v." <cs*************@csh4u.nlwrote in message
news:1b******************************@zeelandnet.n l...
RobinS schreef:
>Yes, you're right! Good one!

Robin S.
--------------------------
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:nN******************************@comcast.com ...
>>Robin,

Doesn't Wordpad allow one to open a .doc?

Bruce


That's only if you're not using some fancy stuff. And does wordpad open
docs from the latest incarnations of office?

Rinze
If you're talking about Office2007, then probably not, but if they are in
the new xml format, you can open them in the Browser. Or so they said today
at the Microsoft Vista Launch that I attended.

Robin S.
Jan 31 '07 #13

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6631
by: Ian Stiles | last post by:
I have tried everything under the sun to get rid of horrible flashing and flickering that occurs on a CSharp form when the form hosts a TreeView or WebBrowser control and then you resize the form....
5
2883
by: ask josephsen | last post by:
Hi NewsGroup Hope you can help me with this. I'm using the "System.Windows.Forms.WebBrowser" to display a various markuplanguage. And it works fine pointing the "WebBrowser.Url" to a local or...
12
6331
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
0
1555
by: Mark | last post by:
I am converting a VB6/COM application to VB.NET and must remove all COM objects. VB6/COM App Architecture: Windows Form hosts WebBrowser which loads HTML snippets from local disk. Some of the...
5
6565
by: mabond | last post by:
Hi recently read a posting and reply about Excel processs still running after the Appliction.Quit was called. Thought I might be able to use the same...
0
1353
by: Balex | last post by:
hi, I have a VB.Net app which "reads" in html pages from a web server using winhttp. The purpose is for the app to "fill in" data fields on the page, then send it back to the web server, as if a...
14
4085
by: shamirza | last post by:
Question Do ActiveX DLLs made in VB still need the VB runtimes on the machine? ________________________________________ Answer In a word, Yes. Visual Basic does not support what is known...
2
6345
by: Scott Gravenhorst | last post by:
I recently (within 30 days) downloaded and installed VB 2005 Express. I like it a whole lot... but: I have been trying to work with the WebBrowser control to display a small amount of help text...
0
1795
by: cheenusri | last post by:
Hello friends, i am running slide show(pps file) in vb.net form using webbrowser control in it.while running the form, if right click on the slide, it show some popup menu, here i wan to...
0
7356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7427
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7512
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5069
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3227
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3214
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1577
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
449
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.