【问题标题】:How can I detect postback event in web browser control in VB.NET?如何在 VB.NET 的 Web 浏览器控件中检测回发事件?
【发布时间】:2012-11-03 09:17:15
【问题描述】:

实际上我在 Java 或 C# 中找到了一些示例,我需要简单的方法来检测回发事件。

我想依次向网站发送许多请求并将所有响应写入列表框或其他内容。

Web site:

用户名:86800010865280016

密码:malkabul

示例请求字符串(KAREKOD:表单上的第 3 个文本框!!!)

0108697930090038212747294171305311002531

0108697930090038212747286171305311002531

0108697930090038212792028171305311002532

0108697930090038212883023171305311002533

0108697930090038212883047171305311002533

登录网站后,我设置了请求字符串;

DirectCast(GetWebBroForm1.item("f_karekod"), mshtml.HTMLTextAreaElement).value = CurrentQR

然后点击提交按钮;

DirectCast(GetWebBroForm1.item("Getir", 0), mshtml.HTMLButtonElement).click()

一切正常。

现在的问题是我必须检测回发事件,解析回发信息,然后需要依次发送另一个请求。

非常感谢。

Private Function GetWebBroDoc1() As mshtml.HTMLDocument
    Return DirectCast(WebBro1.Document.DomDocument, mshtml.HTMLDocument)
End Function

Private Function GetWebBroForm1() As mshtml.HTMLFormElement
    If GetWebBroDoc1.forms.length > 0 Then
        Return DirectCast(GetWebBroDoc1.forms.item(0), mshtml.HTMLFormElement)
    Else
        Return Nothing
    End If
End Function       

Private Sub SendQR(ByVal CurrentQR)
    CurrentQR="0108697930090038212747294171305311002531" 'request string
    DirectCast(GetWebBroForm1.item("f_karekod"), mshtml.HTMLTextAreaElement).value = CurrentQR
    Return
End Sub

【问题讨论】:

    标签: vb.net browser postback detect


    【解决方案1】:

    也许这对你有帮助:

    If IsPostBack Then
    'Do something
    Else
    'Do something else
    End If
    

    【讨论】:

      猜你喜欢
      • 2011-08-13
      • 2013-10-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-12-10
      • 2012-02-24
      • 1970-01-01
      • 2019-12-03
      相关资源
      最近更新 更多