⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xmlschema1.vb

📁 Mastering VBNet Include Source Code
💻 VB
字号:
'------------------------------------------------------------------------------
' <autogenerated>
'     This code was generated by a tool.
'     Runtime Version: 1.0.2914.16
'
'     Changes to this file may cause incorrect behavior and will be lost if 
'     the code is regenerated.
' </autogenerated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.Data
Imports System.Runtime.Serialization
Imports System.Xml


<Serializable(),  _
 System.ComponentModel.DesignerCategoryAttribute("code")>  _
Public Class XMLSchema1
    Inherits System.Data.DataSet
    
    Private tableGridData As GridDataDataTable
    
    Public Sub New()
        MyBase.New
        Me.InitClass
    End Sub
    
    Private Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
        MyBase.New
        Me.InitClass
        Me.GetSerializationData(info, context)
    End Sub
    
    <System.ComponentModel.Browsable(false),  _
     System.ComponentModel.DesignerSerializationVisibilityAttribute(System.ComponentModel.DesignerSerializationVisibility.Content)>  _
    Public ReadOnly Property GridData As GridDataDataTable
        Get
            Return Me.tableGridData
        End Get
    End Property
    
    Protected Overrides Function ShouldSerializeTables() As Boolean
        Return false
    End Function
    
    Protected Overrides Function ShouldSerializeRelations() As Boolean
        Return false
    End Function
    
    Protected Overrides Sub ReadXmlSerializable(ByVal reader As XmlReader)
        Me.ReadXml(reader, XmlReadMode.IgnoreSchema)
    End Sub
    
    Protected Overrides Function GetSchemaSerializable() As System.Xml.Schema.XmlSchema
        Dim stream As System.IO.MemoryStream = New System.IO.MemoryStream
        Me.WriteXmlSchema(New XmlTextWriter(stream, Nothing))
        stream.Position = 0
        Return System.Xml.Schema.XmlSchema.Read(New XmlTextReader(stream), Nothing)
    End Function
    
    Private Sub InitClass()
        Me.DataSetName = "XMLSchema1"
        Me.Namespace = "http://tempuri.org/XMLSchema1.xsd"
        Me.tableGridData = New GridDataDataTable
        Me.Tables.Add(Me.tableGridData)
    End Sub
    
    Private Function ShouldSerializeGridData() As Boolean
        Return false
    End Function
    
    Public Delegate Sub GridDataRowChangeEventHandler(ByVal sender As Object, ByVal e As GridDataRowChangeEvent)
    
    Public Class GridDataDataTable
        Inherits DataTable
        Implements System.Collections.IEnumerable
        
        Private columnLastName As DataColumn
        
        Private columnFirstName As DataColumn
        
        Private columnBalance As DataColumn
        
        Private columnAcountNo As DataColumn
        
        Friend Sub New()
            MyBase.New("GridData")
            Me.InitClass
        End Sub
        
        <System.ComponentModel.Browsable(false)>  _
        Public ReadOnly Property Count As Integer
            Get
                Return Me.Rows.Count
            End Get
        End Property
        
        Friend ReadOnly Property LastNameColumn As DataColumn
            Get
                Return Me.columnLastName
            End Get
        End Property
        
        Friend ReadOnly Property FirstNameColumn As DataColumn
            Get
                Return Me.columnFirstName
            End Get
        End Property
        
        Friend ReadOnly Property BalanceColumn As DataColumn
            Get
                Return Me.columnBalance
            End Get
        End Property
        
        Friend ReadOnly Property AcountNoColumn As DataColumn
            Get
                Return Me.columnAcountNo
            End Get
        End Property
        
        Public Default ReadOnly Property Item(ByVal index As Integer) As GridDataRow
            Get
                Return CType(Me.Rows(index),GridDataRow)
            End Get
        End Property
        
        Public Event GridDataRowChanged As GridDataRowChangeEventHandler
        
        Public Event GridDataRowChanging As GridDataRowChangeEventHandler
        
        Public Event GridDataRowDeleted As GridDataRowChangeEventHandler
        
        Public Event GridDataRowDeleting As GridDataRowChangeEventHandler
        
        Public Overloads Sub AddGridDataRow(ByVal row As GridDataRow)
            Me.Rows.Add(row)
        End Sub
        
        Public Overloads Function AddGridDataRow(ByVal LastName As String, ByVal FirstName As String, ByVal Balance As System.UInt64, ByVal AcountNo As String) As GridDataRow
            Dim rowGridDataRow As GridDataRow = CType(Me.NewRow,GridDataRow)
            rowGridDataRow.ItemArray = New Object() {LastName, FirstName, Balance, AcountNo}
            Me.Rows.Add(rowGridDataRow)
            Return rowGridDataRow
        End Function
        
        Public Function GetEnumerator() As System.Collections.IEnumerator Implements System.Collections.IEnumerable.GetEnumerator
            Return Me.Rows.GetEnumerator
        End Function
        
        Private Sub InitClass()
            Me.columnLastName = New DataColumn("LastName", GetType(System.String), "", System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnLastName)
            Me.columnFirstName = New DataColumn("FirstName", GetType(System.String), "", System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnFirstName)
            Me.columnBalance = New DataColumn("Balance", GetType(System.UInt64), "", System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnBalance)
            Me.columnAcountNo = New DataColumn("AcountNo", GetType(System.String), "", System.Data.MappingType.Attribute)
            Me.Columns.Add(Me.columnAcountNo)
        End Sub
        
        Public Function NewGridDataRow() As GridDataRow
            Return CType(Me.NewRow,GridDataRow)
        End Function
        
        Protected Overrides Function NewRowFromBuilder(ByVal builder As DataRowBuilder) As DataRow
            'We need to ensure that all Rows in the tabled are typed rows.
            'Table calls newRow whenever it needs to create a row.
            'So the following conditions are covered by Row newRow(Record record)
            '* Cursor calls table.addRecord(record) 
            '* table.addRow(object[] values) calls newRow(record)    
            Return New GridDataRow(builder)
        End Function
        
        Protected Overrides Function GetRowType() As System.Type
            Return GetType(GridDataRow)
        End Function
        
        Protected Overrides Sub OnRowChanged(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanged(e)
            If (Not (Me.GridDataRowChangedEvent) Is Nothing) Then
                RaiseEvent GridDataRowChanged(Me, New GridDataRowChangeEvent(CType(e.Row,GridDataRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowChanging(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowChanging(e)
            If (Not (Me.GridDataRowChangingEvent) Is Nothing) Then
                RaiseEvent GridDataRowChanging(Me, New GridDataRowChangeEvent(CType(e.Row,GridDataRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleted(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleted(e)
            If (Not (Me.GridDataRowDeletedEvent) Is Nothing) Then
                RaiseEvent GridDataRowDeleted(Me, New GridDataRowChangeEvent(CType(e.Row,GridDataRow), e.Action))
            End If
        End Sub
        
        Protected Overrides Sub OnRowDeleting(ByVal e As DataRowChangeEventArgs)
            MyBase.OnRowDeleting(e)
            If (Not (Me.GridDataRowDeletingEvent) Is Nothing) Then
                RaiseEvent GridDataRowDeleting(Me, New GridDataRowChangeEvent(CType(e.Row,GridDataRow), e.Action))
            End If
        End Sub
        
        Public Sub RemoveGridDataRow(ByVal row As GridDataRow)
            Me.Rows.Remove(row)
        End Sub
    End Class
    
    Public Class GridDataRow
        Inherits DataRow
        
        Private tableGridData As GridDataDataTable
        
        Friend Sub New(ByVal rb As DataRowBuilder)
            MyBase.New(rb)
            Me.tableGridData = CType(Me.Table,GridDataDataTable)
        End Sub
        
        Public Property LastName As String
            Get
                Try 
                    Return CType(Me(Me.tableGridData.LastNameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableGridData.LastNameColumn) = value
            End Set
        End Property
        
        Public Property FirstName As String
            Get
                Try 
                    Return CType(Me(Me.tableGridData.FirstNameColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableGridData.FirstNameColumn) = value
            End Set
        End Property
        
        Public Property Balance As System.UInt64
            Get
                Try 
                    Return CType(Me(Me.tableGridData.BalanceColumn),System.UInt64)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableGridData.BalanceColumn) = value
            End Set
        End Property
        
        Public Property AcountNo As String
            Get
                Try 
                    Return CType(Me(Me.tableGridData.AcountNoColumn),String)
                Catch e As InvalidCastException
                    Throw New StrongTypingException("Cannot get value because it is DBNull.", e)
                End Try
            End Get
            Set
                Me(Me.tableGridData.AcountNoColumn) = value
            End Set
        End Property
        
        Public Function IsLastNameNull() As Boolean
            Return Me.IsNull(Me.tableGridData.LastNameColumn)
        End Function
        
        Public Sub SetLastNameNull()
            Me(Me.tableGridData.LastNameColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsFirstNameNull() As Boolean
            Return Me.IsNull(Me.tableGridData.FirstNameColumn)
        End Function
        
        Public Sub SetFirstNameNull()
            Me(Me.tableGridData.FirstNameColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsBalanceNull() As Boolean
            Return Me.IsNull(Me.tableGridData.BalanceColumn)
        End Function
        
        Public Sub SetBalanceNull()
            Me(Me.tableGridData.BalanceColumn) = System.Convert.DBNull
        End Sub
        
        Public Function IsAcountNoNull() As Boolean
            Return Me.IsNull(Me.tableGridData.AcountNoColumn)
        End Function
        
        Public Sub SetAcountNoNull()
            Me(Me.tableGridData.AcountNoColumn) = System.Convert.DBNull
        End Sub
    End Class
    
    Public Class GridDataRowChangeEvent
        Inherits EventArgs
        
        Private eventRow As GridDataRow
        
        Private eventAction As System.Data.DataRowAction
        
        Public Sub New(ByVal row As GridDataRow, ByVal action As DataRowAction)
            MyBase.New
            Me.eventRow = row
            Me.eventAction = action
        End Sub
        
        Public ReadOnly Property Row As GridDataRow
            Get
                Return Me.eventRow
            End Get
        End Property
        
        Public ReadOnly Property Action As DataRowAction
            Get
                Return Me.eventAction
            End Get
        End Property
    End Class
End Class

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -