473,549 Members | 3,048 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,jp g) 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.D ocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.U rl = New Uri("d:\doc\job list.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 5984
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*******@yaho o.com.hkwrote in message
news:eH******** ******@TK2MSFTN GP02.phx.gbl...
>I want to write a program to display files (xls, doc,html,pdf,jp g) 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.D ocumentStream = fs
==>show binary data, not Excel data

I also try:
WebBrowserMsg.U rl = New Uri("d:\doc\job list.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****** *************** *********@comca st.com...
>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*******@yaho o.com.hkwrote in message
news:eH******** ******@TK2MSFTN GP02.phx.gbl...
>>I want to write a program to display files (xls, doc,html,pdf,jp g) 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\job list.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*******@yaho o.com.hkwrote in message
news:O9******** ******@TK2MSFTN GP04.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****** *************** *********@comca st.com...
>>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*******@yaho o.com.hkwrote in message
news:eH******* *******@TK2MSFT NGP02.phx.gbl.. .
>>>I want to write a program to display files (xls, doc,html,pdf,jp g) 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\job list.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****** *************** *********@comca st.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*******@yaho o.com.hkwrote in message
news:O9******** ******@TK2MSFTN GP04.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****** *************** *********@comca st.com...
>>>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*******@yaho o.com.hkwrote in message
news:eH****** ********@TK2MSF TNGP02.phx.gbl. ..
I want to write a program to display files (xls, doc,html,pdf,jp g) 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")
WebBrowserMs g.DocumentStrea m = fs
==>show binary data, not Excel data

I also try:
WebBrowserMs g.Url = New Uri("d:\doc\job list.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*******@yaho o.com.hkwrote in message
news:O9******** ******@TK2MSFTN GP04.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****** *************** *********@comca st.com...
>>>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*******@yaho o.com.hkwrote in message
news:eH****** ********@TK2MSF TNGP02.phx.gbl. ..
I want to write a program to display files (xls, doc,html,pdf,jp g) 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")
WebBrowserMs g.DocumentStrea m = fs
==>show binary data, not Excel data

I also try:
WebBrowserMs g.Url = New Uri("d:\doc\job list.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******@atcom cast.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*******@yaho o.com.hkwrote in message
news:O9******* *******@TK2MSFT NGP04.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****** *************** *********@comca st.com...
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*******@yaho o.com.hkwrote in message
news:eH***** *********@TK2MS FTNGP02.phx.gbl ...
>I want to write a program to display files (xls, doc,html,pdf,jp g) 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")
WebBrowserM sg.DocumentStre am = fs
==>show binary data, not Excel data
>
I also try:
WebBrowserM sg.Url = New Uri("d:\doc\job list.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******@atcom cast.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******* *************** ********@comcas t.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*******@yaho o.com.hkwrote in message
news:O9****** ********@TK2MSF TNGP04.phx.gbl. ..
Yes. I know this function and I think it should work. But I hope my
applicatio n 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****** *************** *********@comca st.com...
>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*******@yaho o.com.hkwrote in message
news:eH**** **********@TK2M SFTNGP02.phx.gb l...
>>I want to write a program to display files (xls, doc,html,pdf,jp g) 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")
>WebBrowser Msg.DocumentStr eam = fs
>==>show binary data, not Excel data
>>
>I also try:
>WebBrowser Msg.Url = New Uri("d:\doc\job list.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

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

Similar topics

5
6636
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. Here is what I've tried so far: 1. Turning off CS_VREDRAW and CS_HREDRAW in both the parent form and a subclass of the control via the "override...
5
2884
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 remote uri. But what I would actually like to do, is to download a webpage as a string, analyze it, possibly modify it, and then display it on the...
12
6339
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 of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a...
0
1566
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 HTML snippets contain <objecttags for ActiveX Control. ActiveX Control loads and works without issue. VB.NET App Architecture: SAME as above...
5
6568
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 (System.Runtime.InteropServices.Marshal.ReleaseComObject(exApplication)) to solve my problem but could not. Background : My app uses a WebBrowser control to display to the user the contents...
0
1361
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 user had been entering the data in his web browser. It's part of a data input automation project. I'd like, for my own testing, to show the pages I...
14
4090
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 as "Static
2
6346
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 for my application and though I've finally made it work, it seems a bit quirky, so perhaps that's the control being quirky or perhaps there is...
0
1804
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 disable all mouse click events on slide show which is inside the webbrowser control, i tried all the ways, but cant disable it.If anyone know the...
0
7520
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7956
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7470
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7809
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5088
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1936
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 we have to send another system
0
763
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.