473,385 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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 10288
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_StatusTextChange 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.8 1.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_StatusTextChange 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.8 1.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
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...
3
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...
0
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...
1
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. ...
15
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...
1
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...
5
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...
1
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.