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

📄 frm_bmzl.frm

📁 VB物流管理系统毕业设计带源码源码+论文 vB+sql的毕业设计
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         MultiLine       =   -1  'True
         ScrollBars      =   2  'Vertical
         TabIndex        =   6
         Top             =   1020
         Width           =   2775
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Index           =   1
         Left            =   1110
         TabIndex        =   5
         Top             =   645
         Width           =   2775
      End
      Begin VB.TextBox Text1 
         Height          =   300
         Index           =   0
         Left            =   1110
         TabIndex        =   3
         Top             =   240
         Width           =   2775
      End
      Begin VB.Label Label8 
         Caption         =   "备注信息"
         Height          =   285
         Left            =   120
         TabIndex        =   7
         Top             =   1065
         Width           =   765
      End
      Begin VB.Label Label1 
         Caption         =   "部门名称"
         Height          =   255
         Index           =   1
         Left            =   120
         TabIndex        =   4
         Top             =   705
         Width           =   855
      End
      Begin VB.Label Label1 
         Caption         =   "部门编号"
         Height          =   255
         Index           =   0
         Left            =   120
         TabIndex        =   2
         Top             =   345
         Width           =   855
      End
   End
End
Attribute VB_Name = "Frm_Bmzl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim i As Integer
Dim c

Private Sub Dgr_bmzl_Click()
  On Error Resume Next
     If Adodc1.Recordset.RecordCount > 0 Then
        Text1(0).Text = Adodc1.Recordset.Fields("bmxx_id")
        Text1(1).Text = Adodc1.Recordset.Fields("bmxx_mc")
        Text1(2).Text = Adodc1.Recordset.Fields("bmxx_bz")
      End If
    For i = 1 To 2
      Text1(i).Locked = False
    Next i
End Sub

Private Sub Form_Load()
   Me.Left = (Screen.Width - Me.Width) / 2
   Me.Top = (Screen.Height - Me.Height) / 2
   Call LoadFile
   For i = 0 To 2
      Text1(i).Locked = True
   Next i
   Adodc1.ConnectionString = PublicStr
   Adodc1.RecordSource = "select * from tb_bmxx order by bmxx_id"
   Adodc1.Refresh
        Call DBGCon
        Call Tbr_cortrol(Tbr_xxcz, True)
End Sub
Private Sub Tbr_xxcz_ButtonClick(ByVal Button As MSComctlLib.Button)
  Select Case Button.Index
     Case 1
         Call Tbr_cortrol(Tbr_xxcz, False)
         For i = 1 To 2
            Text1(i).Locked = False
            Text1(i).Text = ""
            Text1(0).SetFocus
         Next i
           AdoRs.Open "select * from tb_bmxx order by bmxx_id", Cnn, adOpenKeyset
             If AdoRs.RecordCount > 0 Then
                AdoRs.MoveLast
                  StrNum = AdoRs.Fields("bmxx_id")
                  Call Con_idNum       '调用位数转换函数
                  Text1(0).Text = StrIn
              Else
                  Text1(0).Text = "001"
              End If
           AdoRs.Close
     Case 2                            '删除信息
         Call Deletes
     Case 3                            '修改信息
         Call Edits
     Case 4                            '保存信息
        Call Saves
      Case 5
        Call Tbr_cortrol(Tbr_xxcz, True)
        For i = 1 To 2
           Text1(i).Text = ""
           Text1(1).SetFocus
           Text1(i).Locked = True
        Next i
     Case 6
        ConBs = "BM"
        Frm_Cx.Show 1
     Case 7
        Unload Me
  End Select
End Sub

Private Sub Text1_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
   On Error Resume Next
   If KeyCode = 13 Then
      If Index >= 0 Then Text1(Index + 1).SetFocus
      If Index = 2 Then
             Call Saves
      End If
   End If
   If Index >= 0 And KeyCode = 40 Then Text1(Index + 1).SetFocus
   If Index <= 2 And KeyCode = 38 Then Text1(Index - 1).SetFocus
End Sub
Private Sub Saves()     '保存信息的事件过程
 On Error Resume Next
 If Tbr_xxcz.Buttons(5).Enabled = False Then
   Exit Sub
 Else
     If Text1(1).Text = "" Then
         MsgBox "部门名称不能为空", 48, "提示信息"
     Else
          AdoRs.Open "select * from tb_bmxx where bmxx_id='" + Text1(0).Text + "'", Cnn, adOpenKeyset
            If AdoRs.RecordCount > 0 Then
                 MsgBox "该部门信息已经存在", 48, "提示信息"
               AdoRs.Close
            Else
               c = MsgBox("确认保存信息吗", 33, "提示信息")
                 If c = vbOK Then
                   Set AdoRs = Cnn.Execute("insert into tb_bmxx values('" & Text1(0) & "','" & Text1(1) & "','" & Text1(2) & "')")
                   MsgBox "数据保存成功", 64, "提示信息"
                 End If
              AdoRs.Close
                  Adodc1.RecordSource = "select * from tb_bmxx order by bmxx_id"
                  Adodc1.Refresh
                  Call DBGCon
            End If
            Call Tbr_cortrol(Tbr_xxcz, True)
     End If
 End If
End Sub

Private Sub Edits()     '修改信息的事件过程
 On Error Resume Next
 AdoRs.Open "select * from tb_ygxx where ygxx_bm='" + Text1(1) + "'", Cnn, adOpenKeyset
   If AdoRs.RecordCount > 0 Then
       MsgBox "该部门下有关联信息,不允许修改", 48, "提示信息"
   Else
    c = MsgBox("确认修改信息吗", 33, "提示信息")
      If c = vbOK Then
        Set AdoRs = Cnn.Execute("UPDATE tb_bmxx SET bmxx_id='" + Text1(0) + "',bmxx_mc='" + Text1(1) + "',bmxx_bz='" + Text1(2) + "' where bmxx_id='" + Text1(0).Text + "'")
        MsgBox "数据修改成功", 64, "提示信息"
        StrId = Text1(0).Text
        StrTitle = Text1(1).Text
        Call joinRZ
        Adodc1.Refresh
        Call DBGCon
      Else
     End If
   End If
 AdoRs.Close
End Sub
Private Sub LoadFile()
   AdoRs.Open "select * from tb_bmxx", Cnn, adOpenKeyset
     If AdoRs.RecordCount > 0 Then
        Text1(0).Text = AdoRs.Fields("bmxx_id")
        Text1(1).Text = AdoRs.Fields("bmxx_mc")
        Text1(2).Text = AdoRs.Fields("bmxx_bz")
      End If
   AdoRs.Close
End Sub

Private Sub LTbrControl()
   Tbr_Gsxx.Buttons(1).Enabled = True
   Tbr_Gsxx.Buttons(2).Enabled = False
   Tbr_Gsxx.Buttons(3).Enabled = True
End Sub

Private Sub CTbrControl()                 '单击编辑按钮
   Tbr_Gsxx.Buttons(1).Enabled = False
   Tbr_Gsxx.Buttons(2).Enabled = True
   Tbr_Gsxx.Buttons(3).Enabled = True
End Sub
Private Sub Deletes()                     '删除信息
 AdoRs.Open "select * from tb_ygxx where ygxx_bm='" + Text1(1) + "'", Cnn, adOpenKeyset
   If AdoRs.RecordCount > 0 Then
       MsgBox "该部门下有关联信息,不允许删除", 48, "提示信息"
   Else
      c = MsgBox("确认删除该信息吗", 17, "提示信息")
       If c = vbOK Then
          On Error Resume Next
          Adodc1.Recordset.Delete
       End If
       For i = 0 To 2
          Text1(i).Text = ""
       Next i
   End If
 AdoRs.Close
End Sub

Private Sub DBGCon()
    Dgr_bmzl.Columns(0).Caption = "部门编号"
    Dgr_bmzl.Columns(1).Caption = "部门名称"
    Dgr_bmzl.Columns(2).Visible = False
    Dgr_bmzl.Columns(0).Width = 800
    Dgr_bmzl.Columns(1).Width = 1380
End Sub

⌨️ 快捷键说明

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