图 :【TestWebService】的运行界面
Form vb的代码清单如下:
Public Class Form Inherits System Windows Forms Form#Region Windows 窗体设计器生成的代码 Public Sub New ( ) MyBase New ( )该调用是 Windows 窗体设计器所必需的InitializeComponent ( )在 InitializeComponent ( ) 调用之后添加任何初始化End Sub 窗体重写处置以清理组件列表 Protected Overloads Overrides Sub Dispose ( ByVal disposing As Boolean ) If disposing ThenIf Not ( ponents Is Nothing ) Then ponents Dispose ( )End If End If MyBase Dispose ( disposing )End Sub Windows 窗体设计器所必需的Private ponents As System ComponentModel IContainer注意 以下过程是 Windows 窗体设计器所必需的可以使用 Windows 窗体设计器修改此过程不要使用代码编辑器修改它Friend WithEvents Button As System Windows Forms Button Friend WithEvents Button As System Windows Forms Button Friend WithEvents DataGrid As System Windows Forms DataGrid System Diagnostics DebuggerStepThrough ( )Private Sub InitializeComponent ( ) Me Button = New System Windows Forms Button ( ) Me Button = New System Windows Forms Button ( ) Me DataGrid = New System Windows Forms DataGrid ( ) CType ( Me DataGrid System ComponentModel ISupportInitialize ) BeginInit ( ) Me SuspendLayout ( ) Me Button FlatStyle = System Windows Forms FlatStyle Flat Me Button Location = New System Drawing Point ( ) Me Button Name = ButtonMe Button Size = New System Drawing Size ( ) Me Button TabIndex =Me Button Text = 绑定Me Button FlatStyle = System Windows Forms FlatStyle Flat Me Button Location = New System Drawing Point ( ) Me Button Name = ButtonMe Button Size = New System Drawing Size ( ) Me Button TabIndex =Me Button Text = 修改Me DataGrid DataMember =Me DataGrid Dock = System Windows Forms DockStyle Top Me DataGrid HeaderForeColor = System Drawing SystemColors ControlText Me DataGrid Name = DataGridMe DataGrid Size = New System Drawing Size ( ) Me DataGrid TabIndex =Me AutoScaleBaseSize = New System Drawing Size ( ) Me ClientSize = New System Drawing Size ( ) Me Controls AddRange ( New System Windows Forms Control ( ) {Me DataGrid Me Button Me Button } ) Me Name = FormMe Text = 测试Web ServiceCType ( Me DataGrid System ComponentModel ISupportInitialize ) EndInit ( ) Me ResumeLayout ( False )End Sub#End RegionPrivate Sub Button _Click ( ByVal sender As System Object ByVal e As System EventArgs ) Handles Button Click Dim MyService As New localhost Service ( ) DataGrid DataSource = MyService Binding ( ) DataGrid DataMember = Cust End SubPrivate Sub Button _Click ( ByVal sender As System Object ByVal e As System EventArgs ) Handles Button Click Dim MyService As New localhost Service ( ) Dim ds As DataSet = DataGrid DataSource Dim dsChanges As DataSet = ds GetChanges ( ) If Not ( dsChanges Is Nothing ) Thends Merge ( MyService Update ( dsChanges ) True ) End IfEnd SubEnd Class
六 总结
lishixinzhi/Article/program/net/201311/11839
vb.net如何动态调用WebService接口啊调用webservice接口
一般分为静态调用和动态调用
静态调用就是在项目中直接添加服务引用或者web服务引用服务引用vb.net;
动态调用就是通过模拟http协议调用服务引用vb.net,这种网上很多提供动态调用服务服务引用vb.net的处理类,找找直接用就可以了;
静态调用特点服务引用vb.net:服务参数包含复杂类型(比如自定义的一些实体类)用它比较方便,但是服务如果改变(服务地址更新,服务内容更新)就需要在项目中更新服务引用,重新编译程序;
动态调用特点:对于服务参数包含复杂类型的处理不是很好,如果服务内容改变不需要重新编译程序;
大致想到就这样,详细的可以在网上找找相关的网文,很多资料可以参考的
关于VB.NET添加引用的问题添加引用好像只是把引用的文件目录链接过来 , 如果你要发到别人那里也能用 , 就要放在你自己的工程文件包里 。
推荐阅读
- 硬盘里的电影怎么传到电视,电影硬盘怎么拷贝
- 手机视频镜像什么意思,手机视频 镜像
- sync命令linux,sync命令卡一段时间
- .net2.0无法安装,net framework 20无法安装
- linux命令bc退出 linux退出命令行模式
- ios单机卡牌人物收集游戏叫什么,ios单机手游推荐
- u盘放音乐用什么格式,u盘放歌曲
- 硬盘拆下来了怎么修复,硬盘拆出来后怎么拿回资料
- mysql怎么注册账号 mysql注册登录