• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2151
  • Last Modified:

Need to send keys to "Choose File to Upload" dialog box (VB.net)

I've tried several methods but can't seem to successfully send keys to the "Choose File to Upload" box that pops up when the browse button is clicked. I am using the webbrowser control in VB 2008 on an windows 7 pro machine. My last attempt was:

Private Sub TimerTest_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerTest.Tick
        AppActivate("Choose File to Upload")
End Sub

The timer is set to fire 5 seconds after the "browse" button has been clicked - The thing about it is I have it looping every 5 seconds - to see if it will tab into an area on filedialog window, but it doesnt - yet when i close the filedialog window and the timer fires, it generates an error - most likely due to the fact that it is actually finding the "Choose File to Upload" but either is not giving it proper focus or sendkeys are not working for some reason. Help with this or another effective method would be appreciated.
  • 3
1 Solution
Why do you want to send keys to the dialog box? Maybe it would be better to replicate the behavior using the objects in the System.Net-namespace.
battlewebAuthor Commented:
samml - can you explain how that would be done? I'm trying to make an application for my website which will automatically update it with content periodically - some of that content includes pictures which is why I would "want to send keys to the dialog box"  - unfortunately, just ftp'ing the content will not work because the site is controlled by php and MySQL and the  <input type="file"> is not editable so, my only other option is to use send keys to fill in the path to the pictures in the open file dialog box that pops up.
battlewebAuthor Commented:
Never mind - this was an issue of timer priority - changing timer to fire before the dialog popped up seemed to have addressed the issue.
battlewebAuthor Commented:
See above for resolution
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

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