扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:马金虎 来源:天极开发 2007年11月9日
关键字:
图03:在【TestWebService】添加Web Service提供的服务 |
组件类型 | 组件名称 | 属性 | 设置结果 |
Form | Form1 | Text | 测试Web Service |
Form1 | MaximizeBox | False | |
Form1 | FormBorderStyle | FixedSingle | |
Button | Button1 | Text | 绑定 |
Button1 | FlatStyle | Flat | |
Button2 | Text | 修改 | |
Button2 | FlatStyle | Flat |
图04:【TestWebService】项目中组件排列位置和顺序 |
Private Sub Button1_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles Button1.Click Dim MyService As New localhost.Service1 ( ) DataGrid1.DataSource = MyService.Binding ( ) DataGrid1.DataMember = "Cust" End Sub |
Private Sub Button2_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles Button2.Click Dim MyService As New localhost.Service1 ( ) Dim ds As DataSet = DataGrid1.DataSource Dim dsChanges As DataSet = ds.GetChanges ( ) If Not ( dsChanges Is Nothing ) Then ds.Merge ( MyService.Update ( dsChanges ) , True ) End If End Sub |
图05:【TestWebService】的运行界面 |
Public Class Form1 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 Then If Not ( components Is Nothing ) Then components.Dispose ( ) End If End If MyBase.Dispose ( disposing ) End Sub 'Windows 窗体设计器所必需的 Private components As System.ComponentModel.IContainer '注意:以下过程是 Windows 窗体设计器所必需的 '可以使用 Windows 窗体设计器修改此过程。 '不要使用代码编辑器修改它。 Friend WithEvents Button1 As System.Windows.Forms.Button Friend WithEvents Button2 As System.Windows.Forms.Button Friend WithEvents DataGrid1 As System.Windows.Forms.DataGrid <System.Diagnostics.DebuggerStepThrough ( ) > Private Sub InitializeComponent ( ) Me.Button1 = New System.Windows.Forms.Button ( ) Me.Button2 = New System.Windows.Forms.Button ( ) Me.DataGrid1 = New System.Windows.Forms.DataGrid ( ) CType ( Me.DataGrid1 , System.ComponentModel.ISupportInitialize ) .BeginInit ( ) Me.SuspendLayout ( ) Me.Button1.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button1.Location = New System.Drawing.Point ( 56 , 216 ) Me.Button1.Name = "Button1" Me.Button1.Size = New System.Drawing.Size ( 75 , 32 ) Me.Button1.TabIndex = 0 Me.Button1.Text = "绑定" Me.Button2.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.Button2.Location = New System.Drawing.Point ( 168 , 216 ) Me.Button2.Name = "Button2" Me.Button2.Size = New System.Drawing.Size ( 75 , 32 ) Me.Button2.TabIndex = 1 Me.Button2.Text = "修改" Me.DataGrid1.DataMember = "" Me.DataGrid1.Dock = System.Windows.Forms.DockStyle.Top Me.DataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText Me.DataGrid1.Name = "DataGrid1" Me.DataGrid1.Size = New System.Drawing.Size ( 292 , 192 ) Me.DataGrid1.TabIndex = 2 Me.AutoScaleBaseSize = New System.Drawing.Size ( 6 , 14 ) Me.ClientSize = New System.Drawing.Size ( 292 , 273 ) Me.Controls.AddRange ( New System.Windows.Forms.Control ( ) {Me.DataGrid1 , Me.Button2 , Me.Button1} ) Me.Name = "Form1" Me.Text = "测试Web Service" CType ( Me.DataGrid1 , System.ComponentModel.ISupportInitialize ) .EndInit ( ) 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 MyService As New localhost.Service1 ( ) DataGrid1.DataSource = MyService.Binding ( ) DataGrid1.DataMember = "Cust" End Sub Private Sub Button2_Click ( ByVal sender As System.Object , ByVal e As System.EventArgs ) Handles Button2.Click Dim MyService As New localhost.Service1 ( ) Dim ds As DataSet = DataGrid1.DataSource Dim dsChanges As DataSet = ds.GetChanges ( ) If Not ( dsChanges Is Nothing ) Then ds.Merge ( MyService.Update ( dsChanges ) , True ) End If End Sub End Class |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者