[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 189
  • Last Modified:

another webbrowser question

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
brookman
Asked:
brookman
  • 5
  • 3
  • 2
1 Solution
 
Ryan ChongCommented:
Hi, create a html editor?
0
 
brookmanAuthor Commented:
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
 
AzraSoundCommented:
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
Industry Leaders: 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!

 
brookmanAuthor Commented:
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
 
brookmanAuthor Commented:
Is there a way to do a setfocus of an object in the html document?
0
 
Ryan ChongCommented:
Sure!
0
 
brookmanAuthor Commented:
can you be a little more descriptive - I tried the obvious.
web1.document.all("PICTURE1_SOURCE").setfocus does not work.
0
 
AzraSoundCommented:
just try:

web1.document.all("PICTURE1_SOURCE").focus
0
 
brookmanAuthor Commented:
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
 
AzraSoundCommented:
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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now