Edit js or HTML code through VB.Net 2008

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Arturo07
    New Member
    • Feb 2010
    • 2

    Edit js or HTML code through VB.Net 2008

    Hi
    I have a axwebrowser control and through it I am editing my website page

    On my main site page I have an attribute that I need that makes a field readonly

    Although it is important to leave it like that on the site, I still need to edit the field through the Vb.net application. Only way to do this as what I see is to remove the readonly (Without doing all the website through VB.Net)

    Is there a way to edit the code on the site through VB.NET in order to remove the readonly attribute and be able to edit that textfield?

    This is part of the code

    <input readonly type="text" size="40" maxlength="40" name="CustomCod e" value="0153151" >

    I just need to remove this readonly attribute here

    Again I am using the axwebbrowser (COM)

    Please help soon and thanks
  • Arturo07
    New Member
    • Feb 2010
    • 2

    #2
    Now I am having this error when doing this code

    For Each script As HtmlElement In Me.AxWebBrowser 1.Document.GetE lementsByTagNam e("script")
    If script.InnerHtm l.Contains("vie werIsLoggedIn") Then
    Dim repl As String = script.InnerHtm l.Replace("Fals e", "True")
    script.SetAttri bute("text", repl)
    End If
    Next

    Unable to cast COM object of type 'mshtml.HTMLScr iptElementClass ' to class type 'System.Windows .Forms.HtmlElem ent'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

    Comment

    • CroCrew
      Recognized Expert Contributor
      • Jan 2008
      • 564

      #3
      Have a look at this for a starting point: http://msdn.microsoft.com/en-us/libr...ermission.aspx

      Happy coding,
      CroCrew~

      Comment

      Working...