473,857 Members | 1,836 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using the Web Browser Control to Browse for a File

I am using Microsoftís Web Browser Control embedded on an Access Form to
browse a specific site. I have a good reason for doing so; the pages on
this site run code which aborts their display unless their window is the
top window; they also treat all child windows as not-logged in windows. So
I have not accomplished what I want with HTAís or IFrames or Pop-Up
Windows. But the Access Form/MS Web Browser combination gives me a top
window with the site in a logged in state while allowing me to manipulate
it and its contents with code in the Access form module. Fabulous!

Part of my application requires browsing the local machine for a file. The
web browser has a nice gui for this; all one has to do is navigate to the
drive or folder wanted in code (.Navigate file://path) and then the gui
takes over. I thought I would use the web browser in the spirit of design
efficiency; since the user must use the web browser for the web site
browsing, why not use the same control for file browsing. But I cannot find
any way to identify the file checked. (Bear in mind that in Access I cannot
use the extended properties and methods of the web browser available in
..NET 2.0). Do you know a way?

If I donít come up with anything tomorrow Iíll put a file input on the web
browserís document body. I am 99 44/100ths% sure this will work fine. But I
feel I should not have to do it.

I suppose you may suggest other ways. Please, remember that whatever I use,
it must act as a top window, it must have a rich collection of properties
and methods, and it must be code-able as an object in the form/application.
Iím thoroughly familiar with API file browsing having written my own
manifestation of it many years ago; but Iíll use it only as a last resort.
I want to make the web browser tell me the name/path of the file I have
clicked!

--
Lyle Fairfield
Sep 19 '06 #1
2 10420
It's relatively simple to determine which File/Folder has been selected.
What I don't see is an easy Event to tag onto.

Look at the Document property of the WebBrowser control. When the control is
in Explorer mode the Document property containes a valid FocusedItem prop
that will point to a File or Folder(via its GetFolder prop). There's even a
seperate Boolean prop to signal whether we are dealing with a Folder or not

While you can use the WBrowser_Status TextChange event it's not the proper
way to go and its a bitch to work with(debug).
I have no experience in hooking WebBrowser control events but there's got to
be sample VB code out there somewhere.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Lyle Fairfield" <ly***********@ aim.comwrote in message
news:Xn******** *************** **********@216. 221.81.119...
>I am using Microsoft's Web Browser Control embedded on an Access Form to
browse a specific site. I have a good reason for doing so; the pages on
this site run code which aborts their display unless their window is the
top window; they also treat all child windows as not-logged in windows. So
I have not accomplished what I want with HTA's or IFrames or Pop-Up
Windows. But the Access Form/MS Web Browser combination gives me a top
window with the site in a logged in state while allowing me to manipulate
it and its contents with code in the Access form module. Fabulous!

Part of my application requires browsing the local machine for a file. The
web browser has a nice gui for this; all one has to do is navigate to the
drive or folder wanted in code (.Navigate file://path) and then the gui
takes over. I thought I would use the web browser in the spirit of design
efficiency; since the user must use the web browser for the web site
browsing, why not use the same control for file browsing. But I cannot
find
any way to identify the file checked. (Bear in mind that in Access I
cannot
use the extended properties and methods of the web browser available in
.NET 2.0). Do you know a way?

If I don't come up with anything tomorrow I'll put a file input on the web
browser's document body. I am 99 44/100ths% sure this will work fine. But
I
feel I should not have to do it.

I suppose you may suggest other ways. Please, remember that whatever I
use,
it must act as a top window, it must have a rich collection of properties
and methods, and it must be code-able as an object in the
form/application.
I'm thoroughly familiar with API file browsing having written my own
manifestation of it many years ago; but I'll use it only as a last resort.
I want to make the web browser tell me the name/path of the file I have
clicked!

--
Lyle Fairfield

Sep 19 '06 #2
Thanks Stephen

FocusedItem works well but, as you point out, there seems to be no easy
way to monitor the selection event. Worse, clicking on the file opens
it, which I don't want to do.
So, I think I'll retreat to the GetOpenFileName comdlg32 API function.

Stephen Lebans wrote:
It's relatively simple to determine which File/Folder has been selected.
What I don't see is an easy Event to tag onto.

Look at the Document property of the WebBrowser control. When the control is
in Explorer mode the Document property containes a valid FocusedItem prop
that will point to a File or Folder(via its GetFolder prop). There's even a
seperate Boolean prop to signal whether we are dealing with a Folder or not

While you can use the WBrowser_Status TextChange event it's not the proper
way to go and its a bitch to work with(debug).
I have no experience in hooking WebBrowser control events but there's got to
be sample VB code out there somewhere.

--

HTH
Stephen Lebans
http://www.lebans.com
Access Code, Tips and Tricks
Please respond only to the newsgroups so everyone can benefit.
"Lyle Fairfield" <ly***********@ aim.comwrote in message
news:Xn******** *************** **********@216. 221.81.119...
I am using Microsoft's Web Browser Control embedded on an Access Form to
browse a specific site. I have a good reason for doing so; the pages on
this site run code which aborts their display unless their window is the
top window; they also treat all child windows as not-logged in windows. So
I have not accomplished what I want with HTA's or IFrames or Pop-Up
Windows. But the Access Form/MS Web Browser combination gives me a top
window with the site in a logged in state while allowing me to manipulate
it and its contents with code in the Access form module. Fabulous!

Part of my application requires browsing the local machine for a file. The
web browser has a nice gui for this; all one has to do is navigate to the
drive or folder wanted in code (.Navigate file://path) and then the gui
takes over. I thought I would use the web browser in the spirit of design
efficiency; since the user must use the web browser for the web site
browsing, why not use the same control for file browsing. But I cannot
find
any way to identify the file checked. (Bear in mind that in Access I
cannot
use the extended properties and methods of the web browser available in
.NET 2.0). Do you know a way?

If I don't come up with anything tomorrow I'll put a file input on the web
browser's document body. I am 99 44/100ths% sure this will work fine. But
I
feel I should not have to do it.

I suppose you may suggest other ways. Please, remember that whatever I
use,
it must act as a top window, it must have a rich collection of properties
and methods, and it must be code-able as an object in the
form/application.
I'm thoroughly familiar with API file browsing having written my own
manifestation of it many years ago; but I'll use it only as a last resort.
I want to make the web browser tell me the name/path of the file I have
clicked!

--
Lyle Fairfield
Sep 19 '06 #3

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

Similar topics

8
1573
by: David | last post by:
Hi I'm developing an internet app. in which I want to prevent the user from being able to browse the web whikst they are in the app. So I want to hide the I.E. address bar and prevent any new instances of I.E. other than the one running the app. I.E. 5 or later are specified as the only programs for running hte app, so I donlt have to be concerned about other, or earlier, browsers. Any pointer would be appreciated. I can't modify the...
3
10617
by: Christopher D. Wiederspan | last post by:
I've got a WebBrowser control in a C# Windows form. I build HTML on the fly and then set it into the control using the DocumentText property of the control. All of this works fine, except that part of the HTML that I construct is an <A> element that links to a local file, something like this: <A HREF="C:\Temp\SomeFile.htm" TARGET="_blank">Test</A> When I click on the link in the browser control, nothing happens. After some...
0
1484
by: dchu | last post by:
Does anyone know how to set printer duplex using browser control (i.e SHDocVw.InternetExplorer) in vb.net without the need to used system.drawing.printing class. Any Guru here?????????????? who can help me!!!!!!!!!!!!!!!!!!
1
2298
by: Adam Clauss | last post by:
I am writing an application which will contain the Microsoft Web Browser control. Is it possible to POST information to a website with it? The user will browse to a page that contains a form. Then, when the navigatecomplete(?) event is called, I would like to automatically submit the form on the given page. Is it possible with this control? Or will I need to manually open an Http connection and handle the transfer myself? Thanks! ...
15
4786
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update button will verify the information that has been entered and updates the data base if the data is correct. Update will throw an exception if the data is not validate based on some given rules. I also have a custom error handling page to show the...
1
2415
by: rh | last post by:
Hi, I am using a Hyperlink control that links to an Excel file. I would like the "File Download" dialog box to appear instead of the Excel file automatically opening within the browser. What do I need to do? Thanks in advance.
5
2017
by: BrianGenisio | last post by:
Hello all, Suppose I am using the browser control in my application to display my own HTML code. Now, suppose I want to show images on the page that I currently have in memory. One way to do this is to write the image to the file system... presumably the temp space... and then grab the IHtmlImgElement object, and set the source to the file location. This works really well.
1
3064
by: celoftis | last post by:
BACKGROUND: I have some PPT slides that have been converted to HTM (ensuring that the show slide animations while browsing checkbox is checked). The original HTM slides have custom animations to allow movie (wmv) playback on mouse click. (All animations have been verified to work when viewing slides in ppt.) Further, I have ensured that the converted HTM file(s) contain only relative file paths. SITUATION #1 When I open the converted...
1
2198
by: dotnetdummy | last post by:
Hi, Can anyone who can help me out if possible. At the moment, I'm working on a window application (vb.net) which print out html document's through a default network printer. I'm using browser control Dim IE As SHDocVw.InternetExplorer) ....
0
9923
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 usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
11083
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10711
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7104
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5774
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5971
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4592
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
2
4191
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3215
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.