Click here to Skip to main content
13,002,343 members (73,262 online)
Rate this:
Please Sign up or sign in to vote.
See more:
Hi All,
I am trying to set the select image path to a file upload control inside a browser control.
I am using this code:

HtmlElement ImgTxt = webBrowser1.Document.GetElementById("ImageName");



but nothing is chnaging can anyone help please?
Posted 19-Jul-12 14:19pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

You're using SendKeys, that means you're using the web browser control in a windows app ? SendKeys is retarded and hacky, you should never use or trust it. It's a VB6 hack that should have died with it.

The file upload control has special protection to stop hackers using it, you can't set it's value in code, and it could well be blocking what you're trying to do here, too.
Mohammad Al Hoss 19-Jul-12 21:17pm
What should I replace it with?
Christian Graus 19-Jul-12 21:21pm
You should expect to interact with elements on your form by getting a reference to them. In this instance, as I said, I don't think it's possible.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170626.1 | Last Updated 19 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100