Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

webbrowser object

Posted on 2001-07-03
9
Medium Priority
?
210 Views
Last Modified: 2008-02-01
I have a filebox object loaded into an IHTMLInputFileElement called FileEl1.

The problem I have now is that I want the program to enter text into this filebox... When I try FileEl1.Value = MyValue nothing happens

Another thing I've tried is first FileEl1.Select and then I use Sendkeys() to enter text, this is however unrealiable, and on win2k I can't get it to work at all, it doesn't give an error msg it just doesn't work.

The last resort that actually worked on all is just Sendkeys()  right away and TAB yourself to the right box... this is however VERY unrealiable...

any ideas?
thx
0
Comment
Question by:kristofer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 5

Expert Comment

by:dredge
ID: 6248690
i think you first idea is on the right track, but it's not .value - i think it's something like .source or .filename ... but i don't remember what, off-hand.
0
 
LVL 2

Author Comment

by:kristofer
ID: 6248709
do you think you could find out? I can't find any of those you proposed under IHTMLInputFileElement in the MSDN Index...
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6248761
this is the default behavior of the file input element.  because it is often used to provide a file location for uploading files from a webpage, for security reasons, you cant set its value, or otherwise you could put anything, and immediately invoke an upload script to grab the file you set as the default.

if you are simply trying to provide a convenience mechanism for your users, look for an alternative.  there is a workaround using IE and layers to hide the file input element, and use a plain text and button elements to give the "look" of supplying a default value, but, in fact, it is only a visual effect.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:kristofer
ID: 6248798
Oh ok, then that's why it doesn't work. Unfortunately I can't use your other suggestion because:
1. I don't administer the homepage
2. It's not purely a visual effect, the text has to go in the file box.

Well... I guess it's back to using Sendkeys("{TAB}...") =(

Shouldn't the FileEl1.Select work under win2k though?
0
 
LVL 2

Author Comment

by:kristofer
ID: 6248812
Oh ok, then that's why it doesn't work. Unfortunately I can't use your other suggestion because:
1. I don't administer the homepage
2. It's not purely a visual effect, the text has to go in the file box.

Well... I guess it's back to using Sendkeys("{TAB}...") =(

Shouldn't the FileEl1.Select work under win2k though?
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 80 total points
ID: 6248826
try calling its .focus method
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6249799
hearing...
0
 
LVL 2

Author Comment

by:kristofer
ID: 6251558
.focus works, thanks a lot.

BTW. How did you know it had a .focus method?? It's not in MSDN under IHTMLInputFileElement...

0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6253466
just about every html element has a .focus method.  it should be in the MSDN under INPUT element, type=file
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question