How To Click A Button On A Web Page From VB

I wont to use this site: (Image with translation attach)
i know how fill the fields "city name" and last name but the code I'm using to find out the search button "Press_Buttun(486 - .WebBrowser1.Location.X, 678 - .WebBrowser1.Location.Y)"
works only if supply 486 and 678 that means the form when web-browser In must be in Only one size and the same with web-Browser control

I found this code but it don't  don't work at all:
        Dim theElementCollection As System.Windows.Forms.HtmlElementCollection = frmMain.WebBrowser1.Document.GetElementsByTagName("input")
        For Each curElement As Windows.Forms.HtmlElement In theElementCollection
            If curElement.GetAttribute("name").Equals("ctl00$SPWebPartManager1$g_188bf43d_b2b0_41b1_8939_2a473c339706$ctl02$m_lnk_Search") Then
                Exit For
            End If

this is the problem: 
i must run this sub with fix coordinate(486,678)
Press_Buttun(486 - .WebBrowser1.Location.X, 678 - .WebBrowser1.Location.Y)

this is the function itself:
Private Sub Press_Buttun(ByVal x1 As Integer, ByVal y1 As Integer)
        Dim handle As IntPtr = search_for_handle(frmMain.Handle, "Internet Explorer_Server")
        Dim lParam As IntPtr = ((y1 << 16)) + x1 ' The coordinates
        Dim wParam As IntPtr = IntPtr.Zero ' Additional parameters for the click (e.g. Ctrl)
        Dim downCode As UInteger = 513 'Left click down code
        Dim upCode As UInteger = 514 'Left click up code
        SendMessage(handle, downCode, wParam, lParam) ' Mouse button down
        SendMessage(handle, upCode, wParam, lParam)
    End Sub

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Check this :
or this :

Else the onclick attribute is set with :
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$SPWebPartManager1$g_188bf43d_b2b0_41b1_8939_2a473c339706$ctl02$m_lnk_Search", "", true, "", "", false, false))

Open in new window

Try to call it directly :
Private Sub Press_Buttun() {
   WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$SPWebPartManager1$g_188bf43d_b2b0_41b1_8939_2a473c339706$ctl02$m_lnk_Search", "", true, "", "", false, false));

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
rshahamAuthor Commented:
thank you It works perfectly
You're welcome! Thanks for the points!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.