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

📄 frmfamilyupdate.frm

📁 适用一般于毕业设计! VB代码源加SQL 数据库 ··
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmFamilyUpdate 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "编辑家庭成员信息"
   ClientHeight    =   3855
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6630
   Icon            =   "FrmFamilyUpdate.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3855
   ScaleWidth      =   6630
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.Frame Frame1 
      Height          =   2895
      Left            =   180
      TabIndex        =   7
      Top             =   120
      Width           =   6255
      Begin VB.TextBox txtMemo 
         Height          =   1080
         Left            =   1320
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   13
         Text            =   "FrmFamilyUpdate.frx":06EA
         Top             =   1560
         Width           =   4575
      End
      Begin VB.TextBox txtName 
         Height          =   375
         Left            =   1320
         TabIndex        =   0
         Text            =   "Name"
         Top             =   285
         Width           =   1455
      End
      Begin VB.TextBox txtRelation 
         Height          =   375
         Left            =   1320
         TabIndex        =   3
         Text            =   "Relation"
         Top             =   720
         Width           =   1455
      End
      Begin VB.TextBox txtPhone 
         Height          =   375
         Left            =   4200
         TabIndex        =   2
         Text            =   "Phone"
         Top             =   720
         Width           =   1695
      End
      Begin VB.TextBox txtWorkingOrg 
         Height          =   375
         Left            =   1320
         TabIndex        =   4
         Text            =   "WorkingOrg"
         Top             =   1140
         Width           =   4575
      End
      Begin VB.ComboBox CboSex 
         Height          =   300
         ItemData        =   "FrmFamilyUpdate.frx":06F1
         Left            =   4200
         List            =   "FrmFamilyUpdate.frx":06FB
         Style           =   2  'Dropdown List
         TabIndex        =   1
         Top             =   278
         Width           =   975
      End
      Begin VB.Label Label6 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "备注"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   300
         TabIndex        =   14
         Top             =   1620
         Width           =   360
      End
      Begin VB.Label Label1 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "姓名"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   300
         TabIndex        =   12
         Top             =   360
         Width           =   360
      End
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "与本人关系"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   300
         TabIndex        =   11
         Top             =   780
         Width           =   900
      End
      Begin VB.Label Label4 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "联系电话"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   3300
         TabIndex        =   10
         Top             =   780
         Width           =   720
      End
      Begin VB.Label Label5 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "工作单位"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   9
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   180
         Left            =   300
         TabIndex        =   9
         Top             =   1200
         Width           =   720
      End
      Begin VB.Label Label2 
         AutoSize        =   -1  'True
         BackColor       =   &H00FFC0C0&
         BackStyle       =   0  'Transparent
         Caption         =   "性别"
         Height          =   180
         Left            =   3300
         TabIndex        =   8
         Top             =   360
         Width           =   360
      End
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   400
      Left            =   3900
      TabIndex        =   6
      Top             =   3240
      Width           =   1185
   End
   Begin VB.CommandButton cmdOk 
      Caption         =   "确定"
      Height          =   400
      Left            =   1440
      TabIndex        =   5
      Top             =   3240
      Width           =   1185
   End
End
Attribute VB_Name = "FrmFamilyUpdate"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
  Dim i As Integer

  '初始化"性别"组合框
  CboSex.Clear
  CboSex.AddItem "男", 0
  CboSex.AddItem "女", 1
  
  If ModifyFlag = 0 Then      '添加记录,初始化控件
    txtName.Text = ""
    txtRelation.Text = ""
    txtPhone.Text = ""
    txtWorkingOrg.Text = ""
    txtMemo.Text = ""
    CboSex.ListIndex = 0
  Else                  '修改记录,设置控件的值
    With FrmStudent
      txtName.Text = IIf(IsNull(.rsFamily!Name), "", .rsFamily!Name)
      For i = 0 To CboSex.ListCount - 1
        If CboSex.List(i) = IIf(IsNull(.rsFamily!Sex), "", .rsFamily!Sex) Then
          CboSex.ListIndex = i
          Exit For
        End If
      Next i
      txtRelation.Text = IIf(IsNull(.rsFamily!Relationship), "", .rsFamily!Relationship)
      txtPhone.Text = IIf(IsNull(.rsFamily!Phone), "", .rsFamily!Phone)
      txtWorkingOrg.Text = IIf(IsNull(.rsFamily!WorkingOrg), "", .rsFamily!WorkingOrg)
      txtMemo.Text = IIf(IsNull(.rsFamily!Memo), "", .rsFamily!Memo)
    End With
  End If
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Set FrmFamilyUpdate = Nothing
End Sub

Private Sub cmdOk_Click()
  On Error GoTo ErrorHandle
  Dim sStuID  As String
  
  '必须输入家庭成员的姓名
  If Trim(txtName.Text) = "" Then
    MsgBox "请输入姓名", vbExclamation + vbOKOnly, "操作提示"
    txtName.SetFocus
    Exit Sub
  End If
  
  '更新记录集
  With FrmStudent
    sStuID = Right(.ListView1.SelectedItem.Key, Len(.ListView1.SelectedItem.Key) - 1)
    '如果新增记录(ModifyFlag=0),需要生成家庭成员内码,设置对应学生内码;
    '如果修改记录,则无需维护内码
    If ModifyFlag = 0 Then
      .rsFamily.AddNew              '新增记录
      .rsFamily!ID = GetRndCode                   '生成新内码
      .rsFamily!StuID = sStuID                      '学生内码
    End If
    .rsFamily!Name = txtName.Text                   '姓名
    .rsFamily!Sex = CboSex.Text                     '性别
    .rsFamily!Relationship = txtRelation.Text         '与本人关系
    .rsFamily!Phone = txtPhone.Text                 '联系电话
    .rsFamily!WorkingOrg = txtWorkingOrg.Text       '工作单位
    .rsFamily!Memo = txtMemo.Text                 '备注
    .rsFamily.Update                '更新记录集
  End With
  
  Unload Me
  
  On Error GoTo 0
  Exit Sub
  
ErrorHandle:
  MsgBox Error(Err.Number), vbExclamation + vbOKOnly, "操作提示"
End Sub

Private Sub cmdCancel_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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