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

📄 accountaddedit.frm

📁 This application i made for handle simple finance this project using VB 6.0, SQL Server 2000 wit
💻 FRM
字号:
VERSION 5.00
Object = "{D18BBD1F-82BB-4385-BED3-E9D31A3E361E}#1.0#0"; "KewlButtonz.ocx"
Begin VB.Form frmAccountAddEdit 
   BackColor       =   &H00FBF7F4&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Account"
   ClientHeight    =   3225
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   5850
   BeginProperty Font 
      Name            =   "Verdana"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "AccountAddEdit.frx":0000
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   215
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   390
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  'CenterScreen
   Begin KewlButtonz.KewlButtons btnCancel 
      Height          =   390
      Left            =   4350
      TabIndex        =   7
      Top             =   2475
      Width           =   1290
      _ExtentX        =   2275
      _ExtentY        =   688
      BTYPE           =   3
      TX              =   "&Cancel"
      ENAB            =   -1  'True
      BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      COLTYPE         =   1
      FOCUSR          =   -1  'True
      BCOL            =   15002603
      BCOLO           =   15002603
      FCOL            =   0
      FCOLO           =   0
      MCOL            =   12632256
      MPTR            =   1
      MICON           =   "AccountAddEdit.frx":0EBA
      UMCOL           =   -1  'True
      SOFT            =   0   'False
      PICPOS          =   0
      NGREY           =   0   'False
      FX              =   0
      HAND            =   0   'False
      CHECK           =   0   'False
      VALUE           =   0   'False
   End
   Begin KewlButtonz.KewlButtons btnSave 
      Height          =   390
      Left            =   3000
      TabIndex        =   6
      Top             =   2475
      Width           =   1290
      _ExtentX        =   2275
      _ExtentY        =   688
      BTYPE           =   3
      TX              =   "&Save"
      ENAB            =   -1  'True
      BeginProperty FONT {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "Verdana"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      COLTYPE         =   1
      FOCUSR          =   -1  'True
      BCOL            =   15002603
      BCOLO           =   15002603
      FCOL            =   0
      FCOLO           =   0
      MCOL            =   12632256
      MPTR            =   1
      MICON           =   "AccountAddEdit.frx":0ED6
      UMCOL           =   -1  'True
      SOFT            =   0   'False
      PICPOS          =   2
      NGREY           =   0   'False
      FX              =   0
      HAND            =   0   'False
      CHECK           =   0   'False
      VALUE           =   0   'False
   End
   Begin VB.TextBox txtSaldo 
      Alignment       =   1  'Right Justify
      Appearance      =   0  'Flat
      Height          =   315
      Left            =   1425
      MaxLength       =   12
      TabIndex        =   5
      Text            =   "0"
      Top             =   1800
      Width           =   1815
   End
   Begin VB.TextBox txtNama 
      Appearance      =   0  'Flat
      Height          =   315
      Left            =   1425
      MaxLength       =   30
      TabIndex        =   3
      Top             =   1425
      Width           =   4215
   End
   Begin VB.TextBox txtKode 
      Appearance      =   0  'Flat
      Height          =   315
      Left            =   1425
      MaxLength       =   6
      TabIndex        =   1
      Top             =   1050
      Width           =   1815
   End
   Begin Irfan.IrfanHeader ihdForm 
      Align           =   1  'Align Top
      Height          =   825
      Left            =   0
      Top             =   0
      Width           =   5850
      _ExtentX        =   10319
      _ExtentY        =   1455
      Text            =   "Account"
   End
   Begin VB.Label lblForm 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Saldo &Awal:"
      Height          =   195
      Index           =   2
      Left            =   225
      TabIndex        =   4
      Top             =   1845
      Width           =   1020
   End
   Begin VB.Label lblForm 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "&Nama:"
      Height          =   195
      Index           =   1
      Left            =   225
      TabIndex        =   2
      Top             =   1470
      Width           =   570
   End
   Begin VB.Label lblForm 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "&Kode:"
      Height          =   195
      Index           =   0
      Left            =   225
      TabIndex        =   0
      Top             =   1095
      Width           =   510
   End
End
Attribute VB_Name = "frmAccountAddEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private lx As MSComctlLib.ListItem

Private Sub btnCancel_Click()

  Call Unload(Me)

End Sub

Private Sub btnSave_Click()

  btnSave.Enabled = False

  If (Not (ValidSave())) Then
    btnSave.Enabled = True
    Exit Sub
  End If

  If (frmAccount.sMenu = SelectedSubMenu.Add) Then

    If (ExistCode(Trim(txtKode.Text))) Then
      Call Message(Replace(LoadResString(3), "@n", "Kode Account"))
      btnSave.Enabled = True
      Exit Sub
    End If

    Call SaveAccount(False, Trim(txtKode.Text), Trim(txtNama.Text), CStr(Format(txtSaldo.Text, "0")))

  Else
    Call SaveAccount(True, Trim(txtKode.Text), Trim(txtNama.Text), CStr(Format(txtSaldo.Text, "0")))

  End If

  btnSave.Enabled = True
  Call Unload(Me)

End Sub

Private Sub Form_Load()

  If (frmAccount.sMenu = SelectedSubMenu.Add) Then
    ihdForm.Text = "Add Account"
  Else
    ihdForm.Text = "Edit Account"
    txtKode.Enabled = False

    With frmAccount.lvAccount.SelectedItem
      txtKode.Text = .Text
      txtNama.Text = .ListSubItems(1).Text
      txtSaldo.Text = .ListSubItems(2).Text
    End With

  End If

End Sub

Private Sub txtKode_GotFocus()

  Call TextFocus(txtKode, True, False)

End Sub

Private Sub txtNama_GotFocus()

  Call TextFocus(txtNama, True, False)

End Sub

Private Sub txtSaldo_Change()

  If (EmptyString(txtSaldo.Text)) Then
    txtSaldo.Text = "0"
  End If

End Sub

Private Sub txtSaldo_GotFocus()

  Call TextFocus(txtSaldo, True, True)

End Sub

Private Sub txtSaldo_LostFocus()

  Call TextFocus(txtSaldo, False, True)

End Sub

Private Function ValidSave() As Boolean

  exString = ""

  If (EmptyString(txtKode.Text)) Then
    Call ErrorStringAdd("- Kode Account harus diisi.")
  Else
    If (Len(Trim(txtKode.Text)) < 6) Then
      Call ErrorStringAdd("- Kode Account harus 6 karakter.")
    End If
  End If

  If (EmptyString(txtNama.Text)) Then
    Call ErrorStringAdd("- Nama Account harus diisi.")
  End If

  If (Not (NumericString(CStr(Format(txtSaldo.Text, "0"))))) Then
    Call ErrorStringAdd("- Saldo awal harus angka.")
  End If

  ValidSave = (ValidationString(exString))

End Function

Private Sub SaveAccount(ByVal editQuery As Boolean, ByVal nKode As String, ByVal nNama As String, ByVal nSaldo As String)
On Error GoTo NoSave

  comm.CommandText = "AccountQuery"
  comm.CommandType = CommandTypeEnum.adCmdStoredProc

  Call comm.Parameters.Append(comm.CreateParameter("@type", DataTypeEnum.adBoolean, , , editQuery))
  Call comm.Parameters.Append(comm.CreateParameter("@code", DataTypeEnum.adChar, , 6, nKode))
  Call comm.Parameters.Append(comm.CreateParameter("@name", DataTypeEnum.adVarChar, , 30, nNama))
  Call comm.Parameters.Append(comm.CreateParameter("@saldo", DataTypeEnum.adVarChar, , 18, nSaldo))

  Call conn.Open
  comm.ActiveConnection = conn

    Call comm.Execute

  Call ClearParameter(comm)
  Call conn.Close

  If (editQuery) Then
    With frmAccount.lvAccount.SelectedItem
      .ListSubItems(1).Text = nNama
      .ListSubItems(2).Text = Format(nSaldo, INTNUMFORMAT)
    End With
  Else
    Set lx = frmAccount.lvAccount.ListItems.Add(, , nKode, , 1)
      Call lx.ListSubItems.Add(, , nNama)
      Call lx.ListSubItems.Add(, , Format(nSaldo, INTNUMFORMAT))

    Call lx.EnsureVisible
    lx.Selected = True
  End If

Exit Sub
NoSave:

  Call CloseConnection(Err)

End Sub

Private Function ExistCode(ByVal nCode As String)
On Error GoTo NoExist

  Dim ec As Boolean
  ec = True

  comm.CommandText = "AccountCodeExist"
  comm.CommandType = CommandTypeEnum.adCmdStoredProc

  Call comm.Parameters.Append(comm.CreateParameter("@code", DataTypeEnum.adVarChar, , 6, nCode))
  Call comm.Parameters.Append(comm.CreateParameter("@exist", DataTypeEnum.adBoolean, ParameterDirectionEnum.adParamOutput))

  Call conn.Open
  comm.ActiveConnection = conn

    Call comm.Execute
    ec = CBool(comm.Parameters(1).Value)

  Call ClearParameter(comm)
  Call conn.Close

  ExistCode = (ec)

Exit Function
NoExist:

  Call CloseConnection(Err)
  ExistCode = (True)

End Function


⌨️ 快捷键说明

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