WebBrowser ActiveElement vb.net


I have a bug when I want to insert a text with more than 2000 characters from a TextArea , if it is less than that amount of characters; inserts the text smoothly.

The ActiveElement returns "Nothing" if I exceed that amount, otherwise it returns system.windows.Forms.HtmlElements .

Friend WithEvents AxWebBrowser1 As New WebBrowser

<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
    Me.components = New System.ComponentModel.Container
    Me.AxWebBrowser1 = New System.Windows.Forms.WebBrowser
    Me.ContextMenuStrip1 = New System.Windows.Forms.ContextMenuStrip(Me.components)
    Me.ListToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem
    Me.List1ToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem

Sub RecoverIndexValues(ByVal sender As Object, ByVal e As System.Windows.Forms.WebBrowserNavigatingEventArgs) Handles AxWebBrowser1.Navigating
    Dim doc1 As System.Windows.Forms.HtmlDocument = Me.AxWebBrowser1.Document
    'Guardar indices
    Dim blnSaveWithRule As Boolean = False

    Trace.WriteLineIf(ZTrace.IsVerbose, "proc RecoverIndexValues.")

    'Valido que no haya ninguna regla pendiente de ejecucion
    If Not IsNothing(doc1) AndAlso doc1.ActiveElement Is Nothing Then
        Dim RuleElement As HtmlElement = doc1.GetElementById("hdnRuleId")
        If (Not IsNothing(RuleElement)) Then
            If (String.Compare(RuleElement.Name, String.Empty)) Then
                Dim RuleValue As String = RuleElement.Name
                RuleElement.Name = String.Empty

                RuleValue = RuleValue.Remove(0, "zamba_rule_".Length)

                If String.Compare(RuleValue.ToLower(), "cancel") = 0 Then
                    RaiseEvent CancelChildRules(True)
                End If
            End If
        End If
        Exit Sub

 Public Sub saveValues(ByVal doc1 As System.Windows.Forms.HtmlDocument, ByVal        closeBrowser As Boolean, ByVal canedit As Boolean)
    If IsNothing(doc1) Then
        doc1 = Me.AxWebBrowser1.Document
    End If


In the end I was able to solve it.

The error was in the HTML code, the form was missing the line


I added it and it works without problems

Scroll to Top