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

📄 communityset.frm

📁 一个用VB6.0开发的简单餐会管理系统。在WIN2K
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "msflxgrd.ocx"
Begin VB.Form CommunitySet 
   AutoRedraw      =   -1  'True
   Caption         =   "社区设置"
   ClientHeight    =   2520
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5025
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   2520
   ScaleWidth      =   5025
   Begin VB.Data Data1 
      Caption         =   "Data1"
      Connect         =   "Access"
      DatabaseName    =   "E:\jp\vb\生日餐会系统\BSystem.mdb"
      DefaultCursorType=   0  '缺省游标
      DefaultType     =   2  '使用 ODBC
      Exclusive       =   0   'False
      Height          =   375
      Left            =   2280
      Options         =   0
      ReadOnly        =   0   'False
      RecordsetType   =   1  'Dynaset
      RecordSource    =   "社区资料"
      Top             =   2160
      Visible         =   0   'False
      Width           =   1455
   End
   Begin VB.Frame Frame1 
      Height          =   735
      Left            =   2280
      TabIndex        =   0
      Top             =   120
      Width           =   2655
      Begin VB.TextBox Text1 
         Height          =   270
         Left            =   1080
         TabIndex        =   2
         Top             =   275
         Width           =   1455
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         Caption         =   "社区名称:"
         Height          =   180
         Left            =   120
         TabIndex        =   1
         Top             =   320
         Width           =   900
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退  出"
      Height          =   495
      Left            =   3720
      TabIndex        =   6
      Top             =   1800
      Width           =   1095
   End
   Begin VB.CommandButton Command3 
      Caption         =   "删  除"
      Height          =   495
      Left            =   3720
      TabIndex        =   5
      Top             =   1080
      Width           =   1095
   End
   Begin VB.CommandButton Command2 
      Caption         =   "修  改"
      Height          =   495
      Left            =   2400
      TabIndex        =   4
      Top             =   1800
      Width           =   1095
   End
   Begin VB.CommandButton Command1 
      Caption         =   "新  增"
      Height          =   495
      Left            =   2400
      TabIndex        =   3
      Top             =   1080
      Width           =   1095
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Bindings        =   "CommunitySet.frx":0000
      Height          =   2295
      Left            =   120
      TabIndex        =   7
      Top             =   120
      Width           =   2055
      _ExtentX        =   3625
      _ExtentY        =   4048
      _Version        =   393216
      Rows            =   9
      FocusRect       =   0
      HighLight       =   2
      SelectionMode   =   1
   End
End
Attribute VB_Name = "CommunitySet"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public nSelCommunityId As Integer

Private Sub Command1_Click()
Dim strSQL As String

strSQL = "SELECT * FROM 社区资料"
Data1.RecordSource = strSQL
Data1.Refresh

With Data1.Recordset
    If Text1.text <> "" Then
        .AddNew
        .Fields("社区名称") = Text1.text
        .Update
    End If
End With
ViewCommunityInfo
Text1.text = ""
End Sub

Private Sub Command2_Click()
Dim strSQL As String

If nSelCommunityId = -1 Then
    Exit Sub
End If
strSQL = "SELECT * FROM 社区资料"
Data1.RecordSource = strSQL
Data1.Refresh

With Data1.Recordset
    If nSelCommunityId > 0 And nSelCommunityId < .RecordCount Then
        .Move (nSelCommunityId)
        .Edit
        .Fields("社区名称") = Text1.text
        .Update
    Else
        Exit Sub
    End If
End With
ViewCommunityInfo
Text1.text = ""
nSelCommunityId = -1
End Sub

Private Sub Command3_Click()
Dim strSQL As String

If nSelCommunityId = -1 Then
    Exit Sub
End If

strSQL = "SELECT * FROM 社区资料"
Data1.RecordSource = strSQL
Data1.Refresh
With Data1.Recordset
    If nSelCommunityId >= 0 And nSelCommunityId < .RecordCount Then
        .Move (nSelCommunityId)
        .Delete
    Else
        Exit Sub
    End If
    
End With
ViewCommunityInfo
Text1.text = ""
nSelCommunityId = -1
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()
Data1.DatabaseName = App.Path & "\BSystem.mdb"

ModifyCommunityForm
ViewCommunityInfo
End Sub


''''''''''''''''''''
'''''社区资料显示
Private Sub ViewCommunityInfo()
Dim strSQL As String
Dim num As Integer

strSQL = "SELECT * FROM 社区资料"
Data1.RecordSource = strSQL
Data1.Refresh

With Data1.Recordset
    
    
    MSFlexGrid1.Clear

    MSFlexGrid1.Cols = 2
    MSFlexGrid1.Rows = 1
    MSFlexGrid1.Row = 0
    MSFlexGrid1.Col = 0

    '显示标志
    MSFlexGrid1.ColWidth(0) = 500
    MSFlexGrid1.ColWidth(1) = 1400

    MSFlexGrid1.TextMatrix(0, 0) = "序号"
    MSFlexGrid1.TextMatrix(0, 1) = "社区名称"
    
    num = 0
    If .RecordCount = 0 Then
        .Close
        Command2.Enabled = False
        Command3.Enabled = False
    Else
        Command2.Enabled = True
        Command3.Enabled = True

        .MoveFirst
        Do While Not .EOF
            num = num + 1
            strTemp = num
            strTemp = strTemp & vbTab & .Fields("社区名称")
    
            MSFlexGrid1.AddItem strTemp
            .MoveNext
        Loop
    End If
End With

End Sub


''''''''''''''''''''
'''''社区对话框结构
Private Sub ModifyCommunityForm()

Me.Height = 2925
Me.Width = 5145
Me.Top = (MainForm.Height - Me.Height) / 2 - 1000
Me.Left = (MainForm.Width - Me.Width) / 2

Text1.text = ""
nSelCommunityId = -1
End Sub


Private Sub MSFlexGrid1_SelChange()
    With Data1.Recordset
        If MSFLXMoveDataRec(Data1.Recordset, MSFlexGrid1) Then
        
            .Move MSFlexGrid1.Row - 1
            nSelCommunityId = .AbsolutePosition
            Text1.text = .Fields("社区名称")
        Else
            Exit Sub
        End If
    End With
End Sub

⌨️ 快捷键说明

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