Solved

another webbrowser question

Posted on 2001-06-03
10
182 Views
Last Modified: 2012-06-22
I hope someone out there is as twisted as me.

I know the webbrowser control pretty well. or so I thought until now.

<html>
<body>
<INPUT name=PICTURE1_SOURCE size=50 type=file accept="image/jpeg,image/jpg">
</body>
</html>

how do I programtically(from VB) set the value of this box. No .value does not work.
0
Comment
Question by:brookman
  • 5
  • 3
  • 2
10 Comments
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 6151438
Hi, create a html editor?
0
 
LVL 2

Author Comment

by:brookman
ID: 6151440
I have written an application in VB to fill in a web page and submit it.  I can't figure out this file object
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6152248
the file type of the input object does not allow for you to set a default value for security reasons.  you cant set this even if you wrote the html yourself.  you can mimic this behavior with an IE only solution (at least i only ever got it working in IE).  i can post if you are interested, but it is a workaround in which you actually hide the file input object and show a regular text and button object in its place.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 2

Author Comment

by:brookman
ID: 6152661
I would like that.  I have tried extensive coding to take apart the html and input the value= string but it gets rid of it.

Let me see what you have.

I tried modifying the html code to change it to a text box instead of a file box to no avail.
0
 
LVL 2

Author Comment

by:brookman
ID: 6152717
Is there a way to do a setfocus of an object in the html document?
0
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 6152729
Sure!
0
 
LVL 2

Author Comment

by:brookman
ID: 6152783
can you be a little more descriptive - I tried the obvious.
web1.document.all("PICTURE1_SOURCE").setfocus does not work.
0
 
LVL 28

Accepted Solution

by:
AzraSound earned 200 total points
ID: 6153166
just try:

web1.document.all("PICTURE1_SOURCE").focus
0
 
LVL 2

Author Comment

by:brookman
ID: 6153203
why the hell can't they stick with a standard - what happened to setfocus? By the way that does it.  I can focus and sendkeys!!!!!Thanks
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6153214
just if youre interested, here is the html (IE only)


<html>
<script language="javascript">
  function getFile() {
      document.frm.fileChoose.click();
      document.frm.txtFile.value = document.frm.fileChoose.value;
  }
</script>

<body>
<form name="frm">
  <input type="text" name="txtFile" size="25" value="">
  <input type="button" value="Choose a File" onclick="getFile()">
  <layer>
      <input type="file" name="fileChoose" style="visibility:hidden"><br>
  </layer>
</form>
</body>
</html>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Validating VB6 Function 19 65
Copy a row 12 64
Getting warning: You are about to delete 1 row(s) 9 52
Powerpoint 2013: Change cell reference in excel link 3 77
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

809 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