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

📄 mnfrm.vb

📁 This application uses OleDb as a backhand communicator with the file to allow the user to : select,
💻 VB
📖 第 1 页 / 共 4 页
字号:
'------------------------------------------------------------------------
'
' Author      : Anas S.
' Date        : 20 Jan 2004
' Version     : 1.0
' Description : An easy Application to link with an access mdb
'               file to allow the user to Delete, Select
'               Update the dataloaded
'               Filter and Search capabilities are also
'               included
'               CreateControls code is done by Radu G 
'               (in C# I converted the Code to VB.net) 
'               I downloaded the code from planet-source-code
'               site I thank him for sharing his code here in planet-source-code
'
'------------------------------------------------------------------------

Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports System.Data.OleDb

Namespace DataEasy
    '/ <summary>
    '/ Summary description for Form1.
    '/ </summary>
    Public Class MainFrm
        Inherits System.Windows.Forms.Form
#Region "Private Declarations"
        Private WithEvents btnNavPrev As System.Windows.Forms.Button
        Private WithEvents lblNavLocation As System.Windows.Forms.Label
        Private WithEvents btnNavNext As System.Windows.Forms.Button
        Private WithEvents btnAdd As System.Windows.Forms.Button
        Private WithEvents btnDelete As System.Windows.Forms.Button
        Private WithEvents btnCancel As System.Windows.Forms.Button
        Private WithEvents btnUpdate As System.Windows.Forms.Button
        Private WithEvents dGrid As System.Windows.Forms.DataGrid
        Private menuFile As System.Windows.Forms.MainMenu
        Private WithEvents menuF As System.Windows.Forms.MenuItem
        Private WithEvents menuF_open As System.Windows.Forms.MenuItem
        Private WithEvents menuItem4 As System.Windows.Forms.MenuItem
        Private WithEvents menuF_save As System.Windows.Forms.MenuItem
        Private WithEvents menuItem7 As System.Windows.Forms.MenuItem
        Private WithEvents menuF_exit As System.Windows.Forms.MenuItem
        Private WithEvents menuSearch As System.Windows.Forms.MenuItem
        Private components As System.ComponentModel.IContainer
        Private WithEvents comboTables As System.Windows.Forms.ComboBox

        Private colType() As String 'This array holds all the columnTypes;
        Private AutoMenu() As System.Windows.Forms.ContextMenu 'AutoDate or AutoNumber Options
        Private GPostion As Integer 'DataGrid's postion from Top
        Private DataLoaded As Boolean = False 'Check if the data is loaded into the system
        Private accessDataSet As DataSet 'the main DataSet
        Private ComboBoxText As String = "" 'the item selected in the ComboTables control
        Private dataSourceFile As String = "" 'source file of the .mdb file
        Private accessDataAdapter As OleDbDataAdapter 'the adapter to be used in conjunction with
        'the database file 
        Private mSearch As System.Windows.Forms.MenuItem
        Private accessConnection As New OleDbConnection()

#End Region
        Public Sub New()
            InitializeComponent()
        End Sub 'New
        'with icons using NiceMenu class

#Region "Windows Form Designer generated code"
        '/ <summary>
        '/ Clean up any resources being used.
        '/ </summary>
        Protected Overloads 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 'Dispose


        '/ <summary>
        '/ Required method for Designer support - do not modify
        '/ the contents of this method with the code editor.
        '/ </summary>
        Private Sub InitializeComponent()
            Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(MainFrm))
            Me.btnNavPrev = New System.Windows.Forms.Button()
            Me.lblNavLocation = New System.Windows.Forms.Label()
            Me.btnNavNext = New System.Windows.Forms.Button()
            Me.btnAdd = New System.Windows.Forms.Button()
            Me.btnDelete = New System.Windows.Forms.Button()
            Me.btnCancel = New System.Windows.Forms.Button()
            Me.btnUpdate = New System.Windows.Forms.Button()
            Me.dGrid = New System.Windows.Forms.DataGrid()
            Me.menuFile = New System.Windows.Forms.MainMenu()
            Me.menuF = New System.Windows.Forms.MenuItem()
            Me.menuF_open = New System.Windows.Forms.MenuItem()
            Me.menuItem4 = New System.Windows.Forms.MenuItem()
            Me.menuF_save = New System.Windows.Forms.MenuItem()
            Me.menuItem7 = New System.Windows.Forms.MenuItem()
            Me.menuF_exit = New System.Windows.Forms.MenuItem()
            Me.mSearch = New System.Windows.Forms.MenuItem()
            Me.menuSearch = New System.Windows.Forms.MenuItem()
            Me.comboTables = New System.Windows.Forms.ComboBox()
            CType(Me.dGrid, System.ComponentModel.ISupportInitialize).BeginInit()
            Me.SuspendLayout()
            '
            'btnNavPrev
            '
            Me.btnNavPrev.Location = New System.Drawing.Point(288, 56)
            Me.btnNavPrev.Name = "btnNavPrev"
            Me.btnNavPrev.Size = New System.Drawing.Size(35, 23)
            Me.btnNavPrev.TabIndex = 50
            Me.btnNavPrev.Text = "<"
            Me.btnNavPrev.Visible = False
            '
            'lblNavLocation
            '
            Me.lblNavLocation.BackColor = System.Drawing.Color.White
            Me.lblNavLocation.Location = New System.Drawing.Point(320, 56)
            Me.lblNavLocation.Name = "lblNavLocation"
            Me.lblNavLocation.Size = New System.Drawing.Size(95, 23)
            Me.lblNavLocation.TabIndex = 51
            Me.lblNavLocation.Text = "No Records"
            Me.lblNavLocation.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
            Me.lblNavLocation.Visible = False
            '
            'btnNavNext
            '
            Me.btnNavNext.Location = New System.Drawing.Point(416, 56)
            Me.btnNavNext.Name = "btnNavNext"
            Me.btnNavNext.Size = New System.Drawing.Size(35, 23)
            Me.btnNavNext.TabIndex = 52
            Me.btnNavNext.Text = ">"
            Me.btnNavNext.Visible = False
            '
            'btnAdd
            '
            Me.btnAdd.Location = New System.Drawing.Point(216, 88)
            Me.btnAdd.Name = "btnAdd"
            Me.btnAdd.TabIndex = 53
            Me.btnAdd.Text = "&Add"
            Me.btnAdd.Visible = False
            '
            'btnDelete
            '
            Me.btnDelete.Location = New System.Drawing.Point(296, 88)
            Me.btnDelete.Name = "btnDelete"
            Me.btnDelete.TabIndex = 54
            Me.btnDelete.Text = "&Delete"
            Me.btnDelete.Visible = False
            '
            'btnCancel
            '
            Me.btnCancel.Location = New System.Drawing.Point(376, 88)
            Me.btnCancel.Name = "btnCancel"
            Me.btnCancel.TabIndex = 55
            Me.btnCancel.Text = "&Cancel"
            Me.btnCancel.Visible = False
            '
            'btnUpdate
            '
            Me.btnUpdate.Location = New System.Drawing.Point(80, 88)
            Me.btnUpdate.Name = "btnUpdate"
            Me.btnUpdate.TabIndex = 49
            Me.btnUpdate.Text = "&Update"
            Me.btnUpdate.Visible = False
            '
            'dGrid
            '
            Me.dGrid.AllowSorting = False
            Me.dGrid.DataMember = ""
            Me.dGrid.Dock = System.Windows.Forms.DockStyle.Bottom
            Me.dGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText
            Me.dGrid.Location = New System.Drawing.Point(0, 222)
            Me.dGrid.Name = "dGrid"
            Me.dGrid.Size = New System.Drawing.Size(536, 144)
            Me.dGrid.TabIndex = 47
            '
            'menuFile
            '
            Me.menuFile.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuF, Me.mSearch})
            '
            'menuF
            '
            Me.menuF.Index = 0
            Me.menuF.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuF_open, Me.menuItem4, Me.menuF_save, Me.menuItem7, Me.menuF_exit})
            Me.menuF.Shortcut = System.Windows.Forms.Shortcut.CtrlS
            Me.menuF.Text = "&File"
            '
            'menuF_open
            '
            Me.menuF_open.Index = 0
            Me.menuF_open.Text = "&Open"
            '
            'menuItem4
            '
            Me.menuItem4.Index = 1
            Me.menuItem4.Text = "-"
            '
            'menuF_save
            '
            Me.menuF_save.Enabled = False
            Me.menuF_save.Index = 2
            Me.menuF_save.Shortcut = System.Windows.Forms.Shortcut.CtrlS
            Me.menuF_save.Text = "&Save"
            '
            'menuItem7
            '
            Me.menuItem7.Index = 3
            Me.menuItem7.Text = "-"
            '
            'menuF_exit
            '
            Me.menuF_exit.Index = 4
            Me.menuF_exit.Text = "E&xit"
            '
            'mSearch
            '
            Me.mSearch.Index = 1
            Me.mSearch.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.menuSearch})
            Me.mSearch.Text = "&Search"
            '
            'menuSearch
            '
            Me.menuSearch.Enabled = False
            Me.menuSearch.Index = 0
            Me.menuSearch.Shortcut = System.Windows.Forms.Shortcut.F12
            Me.menuSearch.Text = "Search &Data"
            '
            'comboTables
            '
            Me.comboTables.Location = New System.Drawing.Point(160, 56)
            Me.comboTables.Name = "comboTables"
            Me.comboTables.Size = New System.Drawing.Size(121, 21)
            Me.comboTables.TabIndex = 56
            Me.comboTables.Text = "Tables"
            Me.comboTables.Visible = False
            '
            'MainFrm
            '
            Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
            Me.ClientSize = New System.Drawing.Size(536, 366)
            Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.dGrid, Me.comboTables, Me.btnNavPrev, Me.lblNavLocation, Me.btnNavNext, Me.btnAdd, Me.btnDelete, Me.btnCancel, Me.btnUpdate})
            Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
            Me.Menu = Me.menuFile
            Me.MinimumSize = New System.Drawing.Size(460, 200)
            Me.Name = "MainFrm"
            Me.Text = "DataEasy"
            CType(Me.dGrid, System.ComponentModel.ISupportInitialize).EndInit()
            Me.ResumeLayout(False)

        End Sub 'InitializeComponent

#End Region

#Region "Menu Click Events"
        ' Nice Menu Click Event
        ' this event is fired when someone clicks an
        ' item in the menu

⌨️ 快捷键说明

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