phpeveryday.com

The best tutorial of php, php framework, php strategies, object oriented oriented,


Web Services .NET Grid: Retrieve Data and Show to Data Grid

Tag: web services, .net, vb.net, grid   Category: PHP Application
post: 15 Apr 2008 read: 295


Web Services PHP - Grid .NET Step By Step Tutorial - Part 6: Last, we will add code for button. When use click button, it retrieve data from server then display to datagrid.

First, create a class named "test_book". You can add item from menu bar: Project > Add Class. Enter name "test_book.vb". Then enter this code:


Public Class test_book

    Private _id As Integer
    Private _title As String
    Private _author As String

    Public Sub New(ByVal id As Integer, ByVal title As String, ByVal author As String)
        _id = id
        _title = title
        _author = author
    End Sub

    Public ReadOnly Property id() As Integer
        Get
            Return _id
        End Get
    End Property

    Public ReadOnly Property title() As String
        Get
            Return _title
        End Get
    End Property

    Public ReadOnly Property author() As String
        Get
            Return _author
        End Get
    End Property

    Public Overloads Overrides Function ToString() As String
        Return String.Format("{0}#{1}#{2}", _id, _title, _author)
    End Function

End Class

Next, Double click on button. Then enter following code:


        Dim arl As New ArrayList
        Dim ws As New library.LibraryService
        Dim str As String = ws.doLibrary("")

        'split each row into array
        Dim arr As Array = str.Split("#")
        Dim book(3) As String

        For Each item As Object In arr
            If item <> Nothing Then
                'split each item
                book = Convert.ToString(item).Split("|")
                arl.Add(New test_book(book(0), book(1), book(2)))
            End If
        Next


        DataGrid1.DataSource = arl
        DataGrid1.Refresh()

Now, try to test it.



Series this article:
Web Services .NET Grid: Create WSDL Document
Web Services .NET Grid: Preparing Database
Web Services .NET Grid: Create SOAP Server
Web Services .NET Grid: Testing with SOAP client
Web Services .NET Grid: Creating User Interface for VB.NET
Web Services .NET Grid: Retrieve Data and Show to Data Grid

| Give Your Opinion | Recommend
Share and Bookmark to: These icons link to social bookmarking sites where readers can share and discover new web pages.
digg del.icio.us technorati Ma.gnolia BlinkList

Recommended articles by other readers:
Web Services: How PHP Kiss VB.NET? (Part 1)
Chart: How to Build Cool Animation Real Time Chart
Joomla: Fast Road to Understand Component Programming
Email: Send Attachement Mail
CAPTCHA - part 3 : "Are you human or ....?" (Build Your CAPTCHA)

What do You Think?
Your Name *:
Email *:
(Will not be published)
Website/URL:
Your Comment *:
* Required


615
posting