WebBrowser ActiveElement vb.net

8

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 number of characters; insert the text without problems.

The ActiveElement returns "Nothing" if I exceed that amount, but 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
    Me.ContextMenuStrip1.SuspendLayout()
    Me.SuspendLayout()



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
    
asked by Andromeda 14.12.2015 в 20:56
source

1 answer

2

In the end I could solve it.

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

method="POST"

I added it and it works without problems

    
answered by 16.12.2015 в 18:23