|
-
Aug 10th, 2011, 01:29 PM
#1
Thread Starter
New Member
Downloading Data from an Internal
Hello, this is my first post here and I am fairly new at VB. Using VB Express2010.
I am trying to design a form that automates a report from my company's internal reporting website. I basically want the form to take the users login info and run a preset report. I manage to create a form with a WebBrowser control with the required website as the default URL. I also successfully put in text boxes and a button to accept the users username and password and log in to the site. The reports are a list of hyperlinks in a table on the left side of the website, once the hyperlink for a particular report is clicked it brings up a form in the middle of the website with some text boxes for the date range of the report. I have coded up to the point where the fields come up to enter the dates. See code below:
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
// take user login info from form
WebBrowser1.Document.GetElementById("txtUserName").SetAttribute("value", TextBox1.Text)
WebBrowser1.Document.GetElementById("txtPassword").SetAttribute("value", TextBox2.Text)
WebBrowser1.Document.GetElementById("cmdSubmit").InvokeMember("click")
//Click the reqired report's hyperlink
WebBrowser1.Navigate("http://reports/LoadReport.aspx?r=0002")
//Enter report date
WebBrowser1.Document.GetElementById("txtDate").SetAttribute("value", "20110801")
When I compile the code does the login and brings up the date entry fields for the report. When I added the last line of code above to enter the required value to the date field on the site it gives an error message (NullReference Exception was Unhandled) on that line. I seached the forums and google but did not find anything and I'm pretty sure I'm using the correct field ID from the HTML source code. Any assistance will be appreciated.
DR.NET
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|