Hey all,

i'm making a small tool to pass some data from my main form to a webpage (basically a ticket #) search for it open it (click it) & close it with provided comments, i'm using getElementByID to fetch the data from webpage & then provide necessary action (eg. send a click, set a value in textbox / combo box etc.). The problem is, when i search for the request it's "ElementID" is different as per the tkt # & hence i cannot hardcode it like the other stuff to "click" this tkt number. After some R&D i found another method : .getElementsByName but not sure how do i use it .

I'm basically stuck @ 2 things :
1. how do i get the value by GetElementsByName
2. after i get the value how do i find its "elementid" based on it's Name

My Code so far:

Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim ResComm, SLAComm, FetchReq As String
        ResComm = txtResComm.Text
        SLAComm = txtSLAComm.Text
        Dim ie
        ie = CreateObject("InternetExplorer.Application")
        'Url = TextBox3.Text
        ie.Visible = True
        ie.Navigate("http://myurl.com")

        Wait(ie)

        With ie.Document

            .getElementByID("ctl00$ContentPlaceHolder1$txtSrNumber").value = Me.txtRCNum.Text 'pass ticket # to webpage

            .getElementByID("ctl00$ContentPlaceHolder1$btn_search").click() ' click on search
            Threading.Thread.Sleep(3000)
            Wait(ie) 'wait till search page is loaded
            '
            Threading.Thread.Sleep(1500)
            FetchReq = .GetElementsByName(txtRCNum.Text).ToString ' <--This is where i'm trying to get the tkt # 
 ' click ticket # hyperlink
            MsgBox("req# : " & FetchReq)

            Threading.Thread.Sleep(1500)
            Wait(ie) ' wait till request is opened
            Threading.Thread.Sleep(1500) 'wait till all request status options are fetched
            .getElementByID("ctl00_ContentPlaceHolder1_ddlmacd_status").focus() 'set focus to request status drop down box
            SendKeys.Send("CC") 'Twice C is for complete
            Wait(ie)
            'Threading.Thread.Sleep(1000)
            SendKeys.Send("^A")
            SendKeys.Send("{Del}")
            SendKeys.Send(ResComm)


        End With
    End Sub
    Sub Wait(ByVal IE)
        'WScript = CreateObject("WScript.Shell")
        Do
            Threading.Thread.Sleep(500)
        Loop While IE.ReadyState < 4 And IE.Busy
        Do
Threading.Thread.Sleep(500)
Loop While IE.ReadyState < 4 And IE.Busy
End Sub