LzmTW.uSystem.uWindows.uForms + uBindingNavigator

Author:水如烟  

Imports  System.ComponentModel

Namespace  LzmTW.uSystem.uWindows.uForms

    
< System.Drawing.ToolboxBitmap( GetType (BindingNavigator)) >  _
    
Public   Class  uBindingNavigator
      
        
Private   WithEvents  gSourceManager  As   New  TablesManager
        
Private   WithEvents  gComboBox  As  ComboBox

        
< Browsable( False ) >  _
        
Public   ReadOnly   Property  SourceManager()  As  TablesManager
            
Get
                
Return  gSourceManager
            
End   Get
        
End Property

        
Private   Sub  gSourceManager_CollectionChanged()  Handles  gSourceManager.CollectionChanged
            
Me .gTableNamesItem.ComboBox.DataSource  =  gSourceManager.Keys
        
End Sub

        
Private   Sub  UpdateToolStripItemEnabled( ByVal  currentIsNotNothing  As   Boolean )
            
Me .gUpdateItem.Enabled  =  currentIsNotNothing
            
Me .gRefleshItem.Enabled  =  currentIsNotNothing

            
If  currentIsNotNothing  Then
                
Me .gUpdateItem.Enabled  =   Me .gSourceManager.Current.DataAdapter  IsNot   Nothing
                
Me .gRefleshItem.Enabled  =   Me .gSourceManager.Current.DataAdapter  IsNot   Nothing
            
End   If

        
End Sub

        
Private   Sub  gSourceManager_CurrentChanged( ByVal  send  As   Object ByVal  e  As   String Handles  gSourceManager.CurrentChanged
            
Me .gBindingSource.DataSource  =   Nothing

            
Dim  mCurrentIsNotNothing  As   Boolean   =   Not   String .IsNullOrEmpty(e)

            
If  mCurrentIsNotNothing  Then
                UpdateToolStripItemEnabled(mCurrentIsNotNothing)
                
Me .gBindingSource.DataSource  =  gSourceManager.Current.Table
            
End   If

            UpdateDataGridViewDataSource()
        
End Sub

        
Private   Sub  UpdateDataGridViewDataSource()
            
If   Me .DataGridview  IsNot   Nothing   Then
                
Me .DataGridview.DataSource  =   Nothing
                
Me .DataGridview.DataSource  =   Me .BindingSource
            
End   If
        
End Sub

        
Private   Sub  gComboBox_SelectedIndexChanged( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gComboBox.SelectedIndexChanged
            
Me .gSourceManager.Select( Me .gTableNamesItem.Text)
        
End Sub

        
Public   Class  TablesManager

            
Public   Event  CurrentChanged( ByVal  send  As   Object ByVal  e  As   String )
            
Public   Event  CollectionChanged()

            
Private  gInformations  As   New  System.Collections.Generic.Dictionary( Of   String , TableInformation)
            
Private  gCurrent  As  TableInformation

            
Public   ReadOnly   Property  Keys()  As   String ()
                
Get
                    
Dim  mKeys(gInformations.Count  -   1 As   String
                    gInformations.Keys.CopyTo(mKeys, 
0 )
                    
Return  mKeys
                
End   Get
            
End Property

            
Public   ReadOnly   Property  Count()  As   Integer
                
Get
                    
Return  gInformations.Count
                
End   Get
            
End Property

            
Public   ReadOnly   Property  Current()  As  TableInformation
                
Get
                    
Return  gCurrent
                
End   Get
            
End Property

            
Public   Sub  [ Select ]( ByVal  keyName  As   String )
                
If  gCurrent  IsNot   Nothing   Then
                    
If  gCurrent.KeyName  =  keyName  Then
                        
Exit Sub
                    
End   If
                
End   If

                
If   Not  gInformations.ContainsKey(keyName)  Then
                    
Exit Sub
                
End   If

                gCurrent 
=  gInformations(keyName)
                
RaiseEvent  CurrentChanged( Nothing , keyName)
            
End Sub

            
Public   Sub  Clear()
                gInformations.Clear()
                
RaiseEvent  CollectionChanged()

                
If  gCurrent  IsNot   Nothing   Then
                    gCurrent 
=   Nothing
                    
RaiseEvent  CurrentChanged( Nothing Nothing )
                
End   If
            
End Sub

            
Public   Sub  Add( ByVal  item  As  TableInformation)
                
If  gInformations.ContainsKey(item.KeyName)  Then
                    
Exit Sub
                    
'  Throw New Exception("此键值已存在")
                 End   If

                gInformations.Add(item.KeyName, item)
                
RaiseEvent  CollectionChanged()
            
End Sub

            
Public   Sub  Remove( ByVal  keyName  As   String )
                
If   Not  gInformations.ContainsKey(keyName)  Then
                    
Exit Sub
                
End   If

                gInformations.Remove(keyName)
                
RaiseEvent  CollectionChanged()

                
If  gCurrent  Is   Nothing   Then   Exit Sub

                
If  gCurrent.KeyName  =  keyName  Then
                    gCurrent 
=   Nothing

                    
If  gInformations.Count  >   0   Then
                        
Me .Select( Me .Keys( 0 ))
                    
Else
                        
RaiseEvent  CurrentChanged( Nothing Nothing )
                    
End   If
                
End   If

            
End Sub
        
End Class

        
Public   Class  TableInformation

            
Private   Shared  gIndex  As   Integer   =   1

            
Private  gKeyName  As   String
            
Private  gDataAdapter  As  Data.Common.DbDataAdapter
            
Private  gTable  As  DataTable

            
Sub   New ()
                gTable 
=   New  DataTable( String .Format( " Table{0} " , gIndex))
                gIndex 
+=   1
            
End Sub

            
Sub   New ( ByVal  tableName  As   String )
                gKeyName 
=  tableName
                gTable 
=   New  DataTable(tableName)
            
End Sub

            
Sub   New ( ByVal  tableName  As   String ByVal  keyName  As   String )
                gKeyName 
=  keyName
                gTable 
=   New  DataTable(tableName)
            
End Sub

            
Sub   New ( ByVal  table  As  DataTable,  ByVal  keyName  As   String )
                gTable 
=  table
                gKeyName 
=  keyName
            
End Sub

            
Public   Property  KeyName()  As   String
                
Get
                    
Return  gKeyName
                
End   Get
                
Set ( ByVal  value  As   String )
                    gKeyName 
=  value
                
End   Set
            
End Property

            
Public   Property  DataAdapter()  As  Data.Common.DbDataAdapter
                
Get
                    
Return  gDataAdapter
                
End   Get
                
Set ( ByVal  value  As  Data.Common.DbDataAdapter)
                    gDataAdapter 
=  value
                
End   Set
            
End Property

            
Public   ReadOnly   Property  Table()  As  DataTable
                
Get
                    
Return  gTable
                
End   Get
            
End Property

            
Public   Function  Fill()  As   Integer
                gTable.Clear()
                
Return   Me .gDataAdapter.Fill(gTable)
            
End Function

            
Public   Function  Update()  As   Integer
                
Dim  mCount  As   Integer   =   Me .gDataAdapter.Update(gTable)
                gTable.AcceptChanges()
                
Return  mCount
            
End Function
        
End Class

    
End Class

End Namespace

 

Namespace  LzmTW.uSystem.uWindows.uForms
    
< System.ComponentModel.Designer( GetType (System.Windows.Forms.Design.ControlDesigner)) >  _
    
Partial   Class  uBindingNavigator
        
Inherits  BindingNavigator

        
< System.Diagnostics.DebuggerNonUserCode() >  _
        
Public   Sub   New ( ByVal  Container  As  System.ComponentModel.IContainer)
            
MyClass .New()

            
' Windows.Forms 类撰写设计器支持所必需的
            Container.Add( Me )

        
End Sub

        
< System.Diagnostics.DebuggerNonUserCode() >  _
        
Public   Sub   New ()
            
MyBase .New( False )

            
' 组件设计器需要此调用。

            InitializeComponent()

            AddStandardItems()
            gComboBox 
=   Me .gTableNamesItem.ComboBox

        
End Sub

        
Public   Overrides   Sub  AddStandardItems()
            
Me .Items.AddRange( New  System.Windows.Forms.ToolStripItem() { Me .gFirstItem,  Me .gMovePreviousItem,  Me .s_MovePreviousItem,  Me .gPositionItem,  Me .gCountItem,  Me .s_CountItem,  Me .gMoveNextItem,  Me .gMoveLastItem,  Me .s_MoveLastItem,  Me .gAddNewItem,  Me .gDeleteItem,  Me .gCancelItem,  Me .gCancelAllItem,  Me .s_CancelAllItem,  Me .gUpdateItem,  Me .s_UpdateItem,  Me .gRefleshItem,  Me .s_RefleshItem,  Me .gTableNamesItem,  Me .gGridItem,  Me .gExportItem})

            
Me .AddNewItem  =   Me .gAddNewItem
            
Me .CountItem  =   Me .gCountItem
            
Me .DeleteItem  =   Me .gDeleteItem
            
Me .MoveFirstItem  =   Me .gFirstItem
            
Me .MoveLastItem  =   Me .gMoveLastItem
            
Me .MoveNextItem  =   Me .gMoveNextItem
            
Me .MovePreviousItem  =   Me .gMovePreviousItem
            
Me .PositionItem  =   Me .gPositionItem

        
End Sub


        
' Component 重写 Dispose,以清理组件列表。
         < System.Diagnostics.DebuggerNonUserCode() >  _
        
Protected   Overrides   Sub  Dispose( ByVal  disposing  As   Boolean )
            
If  disposing  AndAlso  components  IsNot   Nothing   Then
                components.Dispose()
            
End   If
            
MyBase .Dispose(disposing)
        
End Sub

        
' 组件设计器所必需的
         Private  components  As  System.ComponentModel.IContainer

        
' 注意: 以下过程是组件设计器所必需的
         ' 可使用组件设计器修改它。
         ' 不要使用代码编辑器修改它。
         < System.Diagnostics.DebuggerStepThrough() >  _
        
Private   Sub  InitializeComponent()
            
Dim  resources  As  System.ComponentModel.ComponentResourceManager  =   New  System.ComponentModel.ComponentResourceManager( GetType (uBindingNavigator))
            
Me .gBindingSource  =   New  BindingSource
            
Me .gAddNewItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gCountItem  =   New  System.Windows.Forms.ToolStripLabel
            
Me .gDeleteItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gFirstItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gMovePreviousItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .s_MovePreviousItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gPositionItem  =   New  System.Windows.Forms.ToolStripTextBox
            
Me .s_CountItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gMoveNextItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gMoveLastItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .s_MoveLastItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gCancelItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .s_CancelAllItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gUpdateItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .s_UpdateItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gRefleshItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .s_RefleshItem  =   New  System.Windows.Forms.ToolStripSeparator
            
Me .gTableNamesItem  =   New  System.Windows.Forms.ToolStripComboBox
            
Me .gCancelAllItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gGridItem  =   New  System.Windows.Forms.ToolStripButton
            
Me .gExportItem  =   New  System.Windows.Forms.ToolStripButton

            
CType ( Me .gBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
            
CType ( Me , System.ComponentModel.ISupportInitialize).BeginInit()

            
Me .SuspendLayout()
            
'
             ' gAddNewItem
             '
             Me .gAddNewItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gAddNewItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.AddNew.bmp " )
            
Me .gAddNewItem.Name  =   " gAddNewItem "
            
Me .gAddNewItem.RightToLeftAutoMirrorImage  =   True
            
Me .gAddNewItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gAddNewItem.Text  =   " 新添 "
            
'
             ' gCountItem
             '
             Me .gCountItem.Name  =   " gCountItem "
            
Me .gCountItem.Size  =   New  System.Drawing.Size( 53 12 )
            
Me .gCountItem.Text  =   " 共 {0,4}项 "
            
Me .gCountItem.ToolTipText  =   " 总项数 "
            
'
             ' gDeleteItem
             '
             Me .gDeleteItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gDeleteItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.Delete.bmp " )
            
Me .gDeleteItem.Name  =   " gDeleteItem "
            
Me .gDeleteItem.RightToLeftAutoMirrorImage  =   True
            
Me .gDeleteItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gDeleteItem.Text  =   " 删除 "
            
'
             ' gFirstItem
             '
             Me .gFirstItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gFirstItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.MoveFirst.bmp " )
            
Me .gFirstItem.Name  =   " gFirstItem "
            
Me .gFirstItem.RightToLeftAutoMirrorImage  =   True
            
Me .gFirstItem.Size  =   New  System.Drawing.Size( 23 22 )
            
Me .gFirstItem.Text  =   " 移到第一条记录 "
            
'
             ' gMovePreviousItem
             '
             Me .gMovePreviousItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gMovePreviousItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.MovePrevious.bmp " )
            
Me .gMovePreviousItem.Name  =   " gMovePreviousItem "
            
Me .gMovePreviousItem.RightToLeftAutoMirrorImage  =   True
            
Me .gMovePreviousItem.Size  =   New  System.Drawing.Size( 23 22 )
            
Me .gMovePreviousItem.Text  =   " 移到上一条记录 "
            
'
             ' s_MovePreviousItem
             '
             Me .s_MovePreviousItem.Name  =   " s_MovePreviousItem "
            
Me .s_MovePreviousItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gPositionItem
             '
             Me .gPositionItem.AccessibleName  =   " 位置 "
            
Me .gPositionItem.AutoSize  =   False
            
Me .gPositionItem.Name  =   " gPositionItem "
            
Me .gPositionItem.Size  =   New  System.Drawing.Size( 50 21 )
            
Me .gPositionItem.Text  =   " 0 "
            
Me .gPositionItem.ToolTipText  =   " 当前位置 "
            
'
             ' s_CountItem
             '
             Me .s_CountItem.Name  =   " s_CountItem "
            
Me .s_CountItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gMoveNextItem
             '
             Me .gMoveNextItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gMoveNextItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.MoveNext.bmp " )
            
Me .gMoveNextItem.Name  =   " gMoveNextItem "
            
Me .gMoveNextItem.RightToLeftAutoMirrorImage  =   True
            
Me .gMoveNextItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gMoveNextItem.Text  =   " 移到下一条记录 "
            
'
             ' gMoveLastItem
             '
             Me .gMoveLastItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gMoveLastItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (BindingNavigator),  " BindingNavigator.MoveLast.bmp " )
            
Me .gMoveLastItem.Name  =   " gMoveLastItem "
            
Me .gMoveLastItem.RightToLeftAutoMirrorImage  =   True
            
Me .gMoveLastItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gMoveLastItem.Text  =   " 移到最后一条记录 "
            
'
             ' s_MoveLastItem
             '
             Me .s_MoveLastItem.Name  =   " s_MoveLastItem "
            
Me .s_MoveLastItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gCancelItem
             '
             Me .gCancelItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gCancelItem.Image  =   CType (SR.GetObject( " CancelItem " ), Image)
            
Me .gCancelItem.Name  =   " gCancelItem "
            
Me .gCancelItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gCancelItem.Text  =   " 放弃当前记录编辑 "
            
'
             ' s_CancelAllItem
             '
             Me .s_CancelAllItem.Name  =   " s_CancelAllItem "
            
Me .s_CancelAllItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gUpdateItem
             '
             Me .gUpdateItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gUpdateItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (ToolStripMenuItem),  " SaveFileDialog.bmp " )
            
Me .gUpdateItem.Name  =   " gUpdateItem "
            
Me .gUpdateItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gUpdateItem.Text  =   " 更新 "
            
Me .gUpdateItem.ToolTipText  =   " 更新至数据库 "
            
'
             ' s_UpdateItem
             '
             Me .s_UpdateItem.Name  =   " s_UpdateItem "
            
Me .s_UpdateItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gRefleshItem
             '
             Me .gRefleshItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gRefleshItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (ToolStripMenuItem),  " OpenFileDialog.bmp " )
            
Me .gRefleshItem.Name  =   " gRefleshItem "
            
Me .gRefleshItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gRefleshItem.Text  =   " 重新加载 "
            
'
             ' s_RefleshItem
             '
             Me .s_RefleshItem.Name  =   " s_RefleshItem "
            
Me .s_RefleshItem.Size  =   New  System.Drawing.Size( 6 25 )
            
'
             ' gTableNamesItem
             '
             Me .gTableNamesItem.DropDownStyle  =  System.Windows.Forms.ComboBoxStyle.DropDownList
            
Me .gTableNamesItem.Name  =   " gTableNamesItem "
            
Me .gTableNamesItem.Size  =   New  System.Drawing.Size( 121 20 )
            
'
             ' gCancelAllItem
             '
             Me .gCancelAllItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gCancelAllItem.Image  =   CType (SR.GetObject( " CancelAllItem " ), Image)
            
Me .gCancelAllItem.Name  =   " gCancelAllItem "
            
Me .gCancelAllItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gCancelAllItem.Text  =   " 放弃所有编辑 "
            
'
             ' gGridItem
             '
             Me .gGridItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gGridItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (DataGridView),  " DataGridView.bmp " )
            
Me .gGridItem.Name  =   " gGridItem "
            
Me .gGridItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gGridItem.Text  =   " 网格属性 "
            
'
             ' gExportItem
             '
             Me .gExportItem.DisplayStyle  =  System.Windows.Forms.ToolStripItemDisplayStyle.Image
            
Me .gExportItem.Image  =  LzmTW.ResourceBitmap.GetMagenta( GetType (ToolStripMenuItem),  " print.bmp " )
            
Me .gExportItem.Name  =   " gExportItem "
            
Me .gExportItem.Size  =   New  System.Drawing.Size( 23 20 )
            
Me .gExportItem.Text  =   " 输出 "
            
'

            
'
             ' uBindingNavigator
             '

            
Me .AllowMerge  =   False
            
Me .CountItemFormat  =   " 共 {0}项 "
            
Me .Stretch  =   True
            
Me .GripStyle  =  System.Windows.Forms.ToolStripGripStyle.Hidden
            
MyBase .BindingSource  =   Me .gBindingSource

            
CType ( Me .gBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
            
CType ( Me , System.ComponentModel.ISupportInitialize).EndInit()
            
Me .ResumeLayout( False )

        
End Sub
        
Private   WithEvents  gCancelItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  s_CancelAllItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gUpdateItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gRefleshItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  s_RefleshItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gTableNamesItem  As  System.Windows.Forms.ToolStripComboBox
        
Private   WithEvents  s_UpdateItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gAddNewItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gCountItem  As  System.Windows.Forms.ToolStripLabel
        
Private   WithEvents  gDeleteItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  s_CountItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gMoveNextItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gMoveLastItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  s_MoveLastItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gFirstItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gMovePreviousItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  s_MovePreviousItem  As  System.Windows.Forms.ToolStripSeparator
        
Private   WithEvents  gPositionItem  As  System.Windows.Forms.ToolStripTextBox
        
Private   WithEvents  gCancelAllItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gGridItem  As  System.Windows.Forms.ToolStripButton
        
Private   WithEvents  gExportItem  As  System.Windows.Forms.ToolStripButton

        
Private   WithEvents  gDataGridView  As  DataGridView
        
Private   WithEvents  gBindingSource  As  BindingSource

    
End Class

End Namespace

 

 

Namespace  LzmTW.uSystem.uWindows.uForms
    
Partial   Class  uBindingNavigator

        
Private   Sub  gGridItem_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gGridItem.Click
            
If   Me .gDataGridView  Is   Nothing   Then   Exit Sub
            
Dim  f  As   New  GridPropertyForm
            f.Show(
Me .gDataGridView)
        
End Sub

        
Private   Sub  gUpdateItem_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gUpdateItem.Click
            
Me .gSourceManager.Current.Update()
        
End Sub

        
Private   Sub  gRefleshItem_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gRefleshItem.Click
            
Me .gSourceManager.Current.Fill()
        
End Sub

        
Private   Sub  gCancelAllItem_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gCancelAllItem.Click
            
CType ( Me .BindingSource.DataSource, DataTable).RejectChanges()
        
End Sub

        
Private   Sub  gCancelItem_Click( ByVal  sender  As   Object ByVal  e  As  System.EventArgs)  Handles  gCancelItem.Click
            
Dim  mRow  As  DataRow  =   CType ( Me .BindingSource.Current, DataRowView).Row
            mRow.RejectChanges()

        
End Sub
    
End Class
End Namespace

 

Imports  System.ComponentModel

Namespace  LzmTW.uSystem.uWindows.uForms
    
Partial   Class  uBindingNavigator
        
< Browsable( False ) >  _
              
Public   Overloads   ReadOnly   Property  BindingSource()  As  BindingSource
            
Get
                
Return   MyBase .BindingSource
            
End   Get
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   ReadOnly   Property  Items()  As  ToolStripItemCollection
            
Get
                
Return   MyBase .Items
            
End   Get
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  AddNewItem()  As  ToolStripItem
            
Get
                
Return   MyBase .AddNewItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .AddNewItem  =  value
            
End   Set
        
End Property


        
< Browsable( False ) >  _
        
Public   Overloads   Property  DeleteItem()  As  ToolStripItem
            
Get
                
Return   MyBase .DeleteItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .DeleteItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  CountItem()  As  ToolStripItem
            
Get
                
Return   MyBase .CountItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .CountItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  PositionItem()  As  ToolStripItem
            
Get
                
Return   MyBase .PositionItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .PositionItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  MoveFirstItem()  As  ToolStripItem
            
Get
                
Return   MyBase .MoveFirstItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .MoveFirstItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  MoveLastItem()  As  ToolStripItem
            
Get
                
Return   MyBase .MoveLastItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .MoveLastItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  MoveNextItem()  As  ToolStripItem
            
Get
                
Return   MyBase .MoveNextItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .MoveNextItem  =  value
            
End   Set
        
End Property

        
< Browsable( False ) >  _
        
Public   Overloads   Property  MovePreviousItem()  As  ToolStripItem
            
Get
                
Return   MyBase .MovePreviousItem
            
End   Get
            
Protected   Set ( ByVal  value  As  ToolStripItem)
                
MyBase .MovePreviousItem  =  value
            
End   Set
        
End Property

        
< System.ComponentModel.DesignerSerializationVisibility(System.ComponentModel.DesignerSerializationVisibility.Visible) >  _
        
Public   Property  DataGridview()  As  DataGridView
            
Get
                
Return   Me .gDataGridView
            
End   Get
            
Set ( ByVal  value  As  DataGridView)
                
Me .gDataGridView  =  value
            
End   Set
        
End Property
    
End Class
End Namespace

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值