3 Replies - 521 Views - Last Post: 18 February 2013 - 05:56 AM Rate Topic: -----

#1 creator333  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 20-January 13

Replace the part of url

Posted 17 February 2013 - 06:05 PM

Hello!
I've got a problem:
I create a code to program which'll be filling in text in webbrowser
Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 If WebBrowser1.Url.ToString = "http://www.zgarnijdoladowanie.pl/gsm?cd=CD7233" Then
            WebBrowser1.document.GetElementById("imie").InnerText = TextBox1.Text
            WebBrowser1.document.GetElementById("plec_m").InvokeMember("click")
            WebBrowser1.document.GetElementById("nazwisko").InnerText = TextBox2.Text
            WebBrowser1.document.GetElementById("wiek_d").InnerText = TextBox3.Text
            WebBrowser1.document.GetElementById("wiek_m").InnerText = TextBox4.Text
            WebBrowser1.document.GetElementById("wiek_y").InnerText = TextBox5.Text
            WebBrowser1.document.GetElementById("email").InnerText = TextBox7.Text
            WebBrowser1.document.GetElementById("telephone").InnerText = TextBox8.Text
            WebBrowser1.document.GetElementById("miasto").InnerText = TextBox9.Text
            WebBrowser1.document.GetElementById("kod_pocztowy").InnerText = TextBox10.Text
            WebBrowser1.document.GetElementById("regulamin").InvokeMember("click")
            WebBrowser1.document.GetElementById("submit").InvokeMember("click")
            WebBrowser1.document.GetElementById("siec")
            Dim DestinationComboBox As HtmlElement = WebBrowser1.document.All.Item("siec")
            DestinationComboBox.SetAttribute("selectedindex", value:=TextBox14.Text)



        End If







    End Sub
End Class

Now question how to replace the code if the website change like that:

http://www.zgarnijdo...l/gsm?cd=CD7233 -> http://www.zgarnijdo...l/gsm?cd=CD7234

but the id's will be still the same.


I was wondering about replace the "gsm?cd=CD7233" into "****" but it doesn't work.

Is This A Good Question/Topic? 0
  • +

Replies To: Replace the part of url

#2 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3190
  • View blog
  • Posts: 10,683
  • Joined: 12-December 12

Re: Replace the part of url

Posted 17 February 2013 - 06:42 PM

If WebBrowser1.Url.ToString.Contains("http://www.zgarnijdoladowanie.pl/gsm?cd") Then

Was This Post Helpful? 1
  • +
  • -

#3 creator333  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 25
  • Joined: 20-January 13

Re: Replace the part of url

Posted 18 February 2013 - 04:30 AM

Works for me!
Thanks a lot ;)

I don't want to start new topic so I ask here - How to do that button on the webbrowser will be clicked one time per 1 minute?
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3190
  • View blog
  • Posts: 10,683
  • Joined: 12-December 12

Re: Replace the part of url

Posted 18 February 2013 - 05:56 AM

View Postcreator333, on 18 February 2013 - 04:30 AM, said:

Works for me!
Thanks a lot ;)/>

I don't want to start new topic so I ask here - How to do that button on the webbrowser will be clicked one time per 1 minute?

Add a Timer control to the form, double-click it to obtain the Tick event. Use some other event to set the Interval for the Timer to 60000 (milliseconds).

[Have it ring an alarm to wake you up to push the button :) ]

This post has been edited by andrewsw: 18 February 2013 - 05:57 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1