Hi,
So I am currently writing an application that takes in user criteria and searches through a webpage for links and then returns them. The application woks just fine if you only want to search once... I cannot figure out how to reset the attributes of the website I am linked to via WebBrowser Control. I set the textfields of the connected website when I click the search button by usingbut then when i go to search again, the user's criteria is different but it doesn't change the WebBrowser control's attributes. For example, if i originally search "ford" in the description on my app and click search it fills in the craigslist search box with "ford" and searches. If I go to change "ford" to "chevy" on my app the WebBrowser control does not change the craigslist textfield and still searches ford.Code:wbCraigsList.Document.GetElementById("query").SetAttribute("value", searchDescription)
Please let me know if you need clarification on anything. Thanks, any help would be awesome!Code:'set the craigslist text fields to the user's criteria Private Sub setUserSearchCriteria(desc As String, min As String, max As String) wbCraigsList.Document.GetElementById("query").SetAttribute("value", desc) wbCraigsList.Document.All.GetElementsByName("minAsk")(0).SetAttribute("value", min) wbCraigsList.Document.All.GetElementsByName("maxAsk")(0).SetAttribute("value", max) End Sub Private Sub clearSearch() txtSearch.Text = Nothing txtMinPrice.Text = Nothing txtMaxPrice.Text = Nothing End Sub 'Starts the search process through Craigslist Private Sub btnSearch_Click(sender As Object, e As EventArgs) Handles btnSearch.Click Try Me.getUserSearchCriteria() MessageBox.Show("Search Description: " + searchDescription) wbCraigsList.Document.GetElementById("query").SetAttribute("value", searchDescription) wbCraigsList.Document.All.GetElementsByName("minAsk")(0).SetAttribute("value", searchMinPrice) wbCraigsList.Document.All.GetElementsByName("maxAsk")(0).SetAttribute("value", searchMaxPrice) wbCraigsList.Document.All("searchbtn").InvokeMember("click") numResults = wbCraigsList.Document.GetElementsByTagName("a").Count 'create an elements collection to store the links of the search results Dim resultsCollection As HtmlElementCollection resultsCollection = wbCraigsList.Document.GetElementsByTagName("a") Results.Show() For i As Integer = 0 To numResults Step 1 Results.txtResults.AppendText("Test" + vbLf) Next Catch ex As Exception MessageBox.Show(ex.Message()) End Try searchDescription = "" End Sub Private Sub btnClear_Click(sender As Object, e As EventArgs) Handles btnClear.Click clearSearch() End Sub




Reply With Quote
