Advertisement

08.15.2005 at 11:46AM PDT, ID: 21527704
[x]
Attachment Details

Can't move focus to the control because it is invisible, not enabled, or of type that does not accept focus

Asked by PhilippeRenaud in Microsoft Visual Basic.Net

Tags: , , ,

the function goes as follows: it is scraping some page HTML to get a value within TAGS.
so it is searching from an URL a specific tag name and it takes the value.

but when I execute my form, it says that: "Can't move focus to the control because it is invisible, not enabled, or of type that does not accept focus"   I dont udnerstand.  
the function is here ->

    Private Function parsingHTML() As String
        Dim doc1 As New mshtml.HTMLDocument, doc2 As mshtml.HTMLDocument
        Dim ips As IPersistStreamInit
        Dim myElements As mshtml.IHTMLElementCollection
        Dim myElement As mshtml.IHTMLElement
        Dim script As mshtml.HTMLScriptElement
        Dim strValue As String
        Try
            ips = DirectCast(doc1, IPersistStreamInit)
            ips.InitNew()
            doc2 = doc1.createDocumentFromUrl(getUrl, vbNullString)
            Do Until doc2.readyState = "complete"
                Application.DoEvents()
                myElements = doc2.getElementsByTagName("INPUT")
                For Each myElement In myElements
                    If myElement.getAttribute("NAME") = "p_iden_tran" Then
                        strValue = myElement.getAttribute("VALUE")
                        Exit Do
                    End If
                Next
            Loop
        Catch e As WebException
            Debug.Write(e.ToString)
        End Try
        Return strValue
    End Function

<- Start Free Trial
 
 
[+][-]08.16.2005 at 05:18AM PDT, ID: 14681805

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.16.2005 at 05:55AM PDT, ID: 14682084

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Visual Basic.Net
Tags: move, control, because, invisible
Sign Up Now!
Solution Provided By: Olaf_Rabbachin
Participating Experts: 2
Solution Grade: B
 
 
[+][-]08.16.2005 at 03:55PM PDT, ID: 14687641

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32