Google Web Service (vb.net)代码

此博客展示了一段VB.NET代码,用于实现Windows窗体应用。代码包含窗体设计器生成的部分,定义了按钮、文本框等组件。还实现了按钮点击事件,通过Google搜索服务进行搜索,并将搜索结果的预估数量显示在文本框中。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer. 
    'Do not modify it using the code editor.
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents tkey As System.Windows.Forms.TextBox
    Friend WithEvents search As System.Windows.Forms.TextBox
    Friend WithEvents rst As System.Windows.Forms.TextBox
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.Button1 = New System.Windows.Forms.Button
        Me.tkey = New System.Windows.Forms.TextBox
        Me.search = New System.Windows.Forms.TextBox
        Me.rst = New System.Windows.Forms.TextBox
        Me.SuspendLayout()
        '
        'Button1
        '
        Me.Button1.Location = New System.Drawing.Point(192, 32)
        Me.Button1.Name = "Button1"
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Button1"
        '
        'tkey
        '
        Me.tkey.Location = New System.Drawing.Point(24, 24)
        Me.tkey.Name = "tkey"
        Me.tkey.TabIndex = 1
        Me.tkey.Text = ""
        '
        'search
        '
        Me.search.Location = New System.Drawing.Point(16, 72)
        Me.search.Name = "search"
        Me.search.TabIndex = 2
        Me.search.Text = ""
        '
        'rst
        '
        Me.rst.Location = New System.Drawing.Point(16, 120)
        Me.rst.Name = "rst"
        Me.rst.TabIndex = 4
        Me.rst.Text = ""
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
        Me.ClientSize = New System.Drawing.Size(292, 273)
        Me.Controls.Add(Me.rst)
        Me.Controls.Add(Me.search)
        Me.Controls.Add(Me.tkey)
        Me.Controls.Add(Me.Button1)
        Me.Name = "Form1"
        Me.Text = "Form1"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim sv As goole.GoogleSearchService = New goole.GoogleSearchService
        Dim result As goole.GoogleSearchResult = New goole.GoogleSearchResult
        Dim mykey As String
        mykey = "wgscd"
        result = sv.doGoogleSearch(mykey, search.Text, 0, 1, False, "", False, "", "", "")
        rst.Text = "Total Found : " & CStr(result.estimatedTotalResultsCount)
    End Sub

  
End Class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值