EditBook.frm
上传用户:zhuahui520
上传日期:2007-05-21
资源大小:347k
文件大小:18k
源码类别:

其他智力游戏

开发平台:

Java

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form EditBook 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "编辑修改图书"
  6.    ClientHeight    =   5745
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   6855
  10.    Icon            =   "EditBook.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5745
  15.    ScaleWidth      =   6855
  16.    ShowInTaskbar   =   0   'False
  17.    StartUpPosition =   2  '屏幕中心
  18.    Begin VB.CommandButton Command1 
  19.       Cancel          =   -1  'True
  20.       Caption         =   "关闭(&C)"
  21.       BeginProperty Font 
  22.          Name            =   "楷体_GB2312"
  23.          Size            =   14.25
  24.          Charset         =   134
  25.          Weight          =   700
  26.          Underline       =   0   'False
  27.          Italic          =   0   'False
  28.          Strikethrough   =   0   'False
  29.       EndProperty
  30.       Height          =   495
  31.       Left            =   5160
  32.       TabIndex        =   18
  33.       Top             =   5160
  34.       Width           =   1455
  35.    End
  36.    Begin VB.Frame Frame2 
  37.       Height          =   135
  38.       Left            =   720
  39.       TabIndex        =   17
  40.       Top             =   4920
  41.       Width           =   5895
  42.    End
  43.    Begin VB.PictureBox Picture2 
  44.       BorderStyle     =   0  'None
  45.       Height          =   1575
  46.       Left            =   240
  47.       ScaleHeight     =   1575
  48.       ScaleWidth      =   6375
  49.       TabIndex        =   13
  50.       Top             =   3360
  51.       Width           =   6375
  52.       Begin VB.CommandButton cmdOkCancel 
  53.          BackColor       =   &H0000C000&
  54.          Caption         =   "取消"
  55.          Height          =   735
  56.          Index           =   1
  57.          Left            =   3840
  58.          Picture         =   "EditBook.frx":0442
  59.          Style           =   1  'Graphical
  60.          TabIndex        =   15
  61.          Top             =   720
  62.          Width           =   1095
  63.       End
  64.       Begin VB.CommandButton cmdOkCancel 
  65.          BackColor       =   &H0000C000&
  66.          Caption         =   "确定"
  67.          Height          =   735
  68.          Index           =   0
  69.          Left            =   1440
  70.          Picture         =   "EditBook.frx":0884
  71.          Style           =   1  'Graphical
  72.          TabIndex        =   14
  73.          Top             =   720
  74.          Width           =   1095
  75.       End
  76.       Begin VB.Label labFlag 
  77.          AutoSize        =   -1  'True
  78.          Caption         =   "确实要修改当前记录吗?"
  79.          BeginProperty Font 
  80.             Name            =   "宋体"
  81.             Size            =   12
  82.             Charset         =   134
  83.             Weight          =   400
  84.             Underline       =   0   'False
  85.             Italic          =   0   'False
  86.             Strikethrough   =   0   'False
  87.          EndProperty
  88.          ForeColor       =   &H000000FF&
  89.          Height          =   240
  90.          Left            =   1920
  91.          TabIndex        =   16
  92.          Top             =   240
  93.          Width           =   2640
  94.       End
  95.    End
  96.    Begin MSComctlLib.ImageList ImageList1 
  97.       Left            =   120
  98.       Top             =   4920
  99.       _ExtentX        =   1005
  100.       _ExtentY        =   1005
  101.       BackColor       =   -2147483643
  102.       ImageWidth      =   32
  103.       ImageHeight     =   32
  104.       MaskColor       =   12632256
  105.       _Version        =   393216
  106.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  107.          NumListImages   =   7
  108.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  109.             Picture         =   "EditBook.frx":0CC6
  110.             Key             =   ""
  111.          EndProperty
  112.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  113.             Picture         =   "EditBook.frx":1126
  114.             Key             =   ""
  115.          EndProperty
  116.          BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  117.             Picture         =   "EditBook.frx":1586
  118.             Key             =   ""
  119.          EndProperty
  120.          BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  121.             Picture         =   "EditBook.frx":19E6
  122.             Key             =   ""
  123.          EndProperty
  124.          BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  125.             Picture         =   "EditBook.frx":1E46
  126.             Key             =   ""
  127.          EndProperty
  128.          BeginProperty ListImage6 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  129.             Picture         =   "EditBook.frx":22A6
  130.             Key             =   ""
  131.          EndProperty
  132.          BeginProperty ListImage7 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  133.             Picture         =   "EditBook.frx":2706
  134.             Key             =   ""
  135.          EndProperty
  136.       EndProperty
  137.    End
  138.    Begin VB.PictureBox Picture1 
  139.       BorderStyle     =   0  'None
  140.       Height          =   1335
  141.       Left            =   360
  142.       ScaleHeight     =   1335
  143.       ScaleWidth      =   6375
  144.       TabIndex        =   11
  145.       Top             =   3360
  146.       Width           =   6375
  147.       Begin MSComctlLib.Toolbar Toolbar1 
  148.          Height          =   855
  149.          Left            =   360
  150.          TabIndex        =   12
  151.          Top             =   240
  152.          Width           =   5175
  153.          _ExtentX        =   9128
  154.          _ExtentY        =   1508
  155.          ButtonWidth     =   1138
  156.          ButtonHeight    =   1349
  157.          Appearance      =   1
  158.          ImageList       =   "ImageList1"
  159.          _Version        =   393216
  160.          BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
  161.             NumButtons      =   12
  162.             BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  163.                Caption         =   "最前"
  164.                ImageIndex      =   1
  165.             EndProperty
  166.             BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  167.                Caption         =   "前一个"
  168.                ImageIndex      =   2
  169.             EndProperty
  170.             BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  171.                Caption         =   "后一个"
  172.                ImageIndex      =   3
  173.             EndProperty
  174.             BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  175.                Caption         =   "最后"
  176.                ImageIndex      =   4
  177.             EndProperty
  178.             BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  179.                Style           =   4
  180.             EndProperty
  181.             BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  182.                Style           =   4
  183.             EndProperty
  184.             BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  185.                Style           =   3
  186.             EndProperty
  187.             BeginProperty Button8 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  188.                Style           =   3
  189.             EndProperty
  190.             BeginProperty Button9 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  191.                Style           =   3
  192.             EndProperty
  193.             BeginProperty Button10 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  194.                Caption         =   "修改"
  195.                ImageIndex      =   5
  196.             EndProperty
  197.             BeginProperty Button11 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  198.                Caption         =   "删除"
  199.                ImageIndex      =   6
  200.             EndProperty
  201.             BeginProperty Button12 {66833FEA-8583-11D1-B16A-00C0F0283628} 
  202.                Caption         =   "查找"
  203.                ImageIndex      =   7
  204.             EndProperty
  205.          EndProperty
  206.          BorderStyle     =   1
  207.       End
  208.    End
  209.    Begin VB.Frame Frame1 
  210.       Caption         =   "图书基本信息"
  211.       Height          =   2895
  212.       Left            =   240
  213.       TabIndex        =   0
  214.       Top             =   360
  215.       Width           =   6375
  216.       Begin VB.TextBox txtBookNum 
  217.          BeginProperty Font 
  218.             Name            =   "宋体"
  219.             Size            =   12
  220.             Charset         =   134
  221.             Weight          =   700
  222.             Underline       =   0   'False
  223.             Italic          =   0   'False
  224.             Strikethrough   =   0   'False
  225.          EndProperty
  226.          ForeColor       =   &H00FF0000&
  227.          Height          =   330
  228.          Left            =   2760
  229.          TabIndex        =   5
  230.          Top             =   600
  231.          Width           =   2055
  232.       End
  233.       Begin VB.TextBox txtBookName 
  234.          BeginProperty Font 
  235.             Name            =   "宋体"
  236.             Size            =   10.5
  237.             Charset         =   134
  238.             Weight          =   400
  239.             Underline       =   0   'False
  240.             Italic          =   0   'False
  241.             Strikethrough   =   0   'False
  242.          EndProperty
  243.          ForeColor       =   &H00000000&
  244.          Height          =   315
  245.          Left            =   1200
  246.          TabIndex        =   4
  247.          Text            =   "Text1"
  248.          Top             =   1290
  249.          Width           =   2535
  250.       End
  251.       Begin VB.TextBox txtBookChu 
  252.          BeginProperty Font 
  253.             Name            =   "宋体"
  254.             Size            =   10.5
  255.             Charset         =   134
  256.             Weight          =   400
  257.             Underline       =   0   'False
  258.             Italic          =   0   'False
  259.             Strikethrough   =   0   'False
  260.          EndProperty
  261.          ForeColor       =   &H00000000&
  262.          Height          =   315
  263.          Left            =   1200
  264.          TabIndex        =   3
  265.          Text            =   "Text1"
  266.          Top             =   2280
  267.          Width           =   2535
  268.       End
  269.       Begin VB.TextBox txtCost 
  270.          BeginProperty Font 
  271.             Name            =   "宋体"
  272.             Size            =   10.5
  273.             Charset         =   134
  274.             Weight          =   400
  275.             Underline       =   0   'False
  276.             Italic          =   0   'False
  277.             Strikethrough   =   0   'False
  278.          EndProperty
  279.          ForeColor       =   &H00000000&
  280.          Height          =   315
  281.          Left            =   4800
  282.          TabIndex        =   2
  283.          Text            =   "Text1"
  284.          Top             =   2280
  285.          Width           =   1335
  286.       End
  287.       Begin VB.ComboBox Combo1 
  288.          BeginProperty Font 
  289.             Name            =   "宋体"
  290.             Size            =   10.5
  291.             Charset         =   134
  292.             Weight          =   400
  293.             Underline       =   0   'False
  294.             Italic          =   0   'False
  295.             Strikethrough   =   0   'False
  296.          EndProperty
  297.          ForeColor       =   &H00000000&
  298.          Height          =   330
  299.          ItemData        =   "EditBook.frx":2B66
  300.          Left            =   4800
  301.          List            =   "EditBook.frx":2B68
  302.          TabIndex        =   1
  303.          Text            =   "Combo1"
  304.          Top             =   1320
  305.          Width           =   1335
  306.       End
  307.       Begin VB.Label Label1 
  308.          AutoSize        =   -1  'True
  309.          Caption         =   "图书编号"
  310.          BeginProperty Font 
  311.             Name            =   "宋体"
  312.             Size            =   12
  313.             Charset         =   134
  314.             Weight          =   700
  315.             Underline       =   0   'False
  316.             Italic          =   0   'False
  317.             Strikethrough   =   0   'False
  318.          EndProperty
  319.          ForeColor       =   &H000000C0&
  320.          Height          =   240
  321.          Index           =   0
  322.          Left            =   1560
  323.          TabIndex        =   10
  324.          Top             =   600
  325.          Width           =   1035
  326.       End
  327.       Begin VB.Label Label1 
  328.          AutoSize        =   -1  'True
  329.          Caption         =   "书  名"
  330.          BeginProperty Font 
  331.             Name            =   "宋体"
  332.             Size            =   12
  333.             Charset         =   134
  334.             Weight          =   700
  335.             Underline       =   0   'False
  336.             Italic          =   0   'False
  337.             Strikethrough   =   0   'False
  338.          EndProperty
  339.          ForeColor       =   &H00FF0000&
  340.          Height          =   240
  341.          Index           =   1
  342.          Left            =   360
  343.          TabIndex        =   9
  344.          Top             =   1320
  345.          Width           =   795
  346.       End
  347.       Begin VB.Label Label1 
  348.          AutoSize        =   -1  'True
  349.          Caption         =   "价  格"
  350.          BeginProperty Font 
  351.             Name            =   "宋体"
  352.             Size            =   12
  353.             Charset         =   134
  354.             Weight          =   700
  355.             Underline       =   0   'False
  356.             Italic          =   0   'False
  357.             Strikethrough   =   0   'False
  358.          EndProperty
  359.          ForeColor       =   &H00FF0000&
  360.          Height          =   240
  361.          Index           =   2
  362.          Left            =   3960
  363.          TabIndex        =   8
  364.          Top             =   2280
  365.          Width           =   795
  366.       End
  367.       Begin VB.Label Label1 
  368.          AutoSize        =   -1  'True
  369.          Caption         =   "类  别"
  370.          BeginProperty Font 
  371.             Name            =   "宋体"
  372.             Size            =   12
  373.             Charset         =   134
  374.             Weight          =   700
  375.             Underline       =   0   'False
  376.             Italic          =   0   'False
  377.             Strikethrough   =   0   'False
  378.          EndProperty
  379.          ForeColor       =   &H00FF0000&
  380.          Height          =   240
  381.          Index           =   3
  382.          Left            =   3960
  383.          TabIndex        =   7
  384.          Top             =   1320
  385.          Width           =   795
  386.       End
  387.       Begin VB.Label Label1 
  388.          AutoSize        =   -1  'True
  389.          Caption         =   "出版社"
  390.          BeginProperty Font 
  391.             Name            =   "宋体"
  392.             Size            =   12
  393.             Charset         =   134
  394.             Weight          =   700
  395.             Underline       =   0   'False
  396.             Italic          =   0   'False
  397.             Strikethrough   =   0   'False
  398.          EndProperty
  399.          ForeColor       =   &H00FF0000&
  400.          Height          =   240
  401.          Index           =   4
  402.          Left            =   360
  403.          TabIndex        =   6
  404.          Top             =   2280
  405.          Width           =   780
  406.       End
  407.       Begin VB.Image Image1 
  408.          Height          =   480
  409.          Left            =   600
  410.          Picture         =   "EditBook.frx":2B6A
  411.          Top             =   480
  412.          Width           =   480
  413.       End
  414.    End
  415. End
  416. Attribute VB_Name = "EditBook"
  417. Attribute VB_GlobalNameSpace = False
  418. Attribute VB_Creatable = False
  419. Attribute VB_PredeclaredId = True
  420. Attribute VB_Exposed = False
  421. Dim db As Database
  422. Dim rst As Recordset
  423. Dim Rec As Integer
  424. Dim StrFlag As String
  425. Dim NumFlag As Boolean
  426. Dim db1 As Database
  427. Dim rst1 As Recordset
  428. Private Sub cmdOkCancel_Click(Index As Integer)
  429. Select Case Index
  430.     Case 0
  431.         If StrFlag = "修改" Then
  432.             rst.Edit
  433.             WriteIn
  434.             rst.Update
  435.             Disp
  436.             Picture2.Visible = False
  437.             Picture1.Visible = True
  438.             SetTxt (False)
  439.         ElseIf StrFlag = "删除" Then
  440.             rst.Delete
  441.             rst.MovePrevious
  442.             If rst.BOF Then rst.MoveNext
  443.             Disp
  444.             Picture2.Visible = False
  445.             Picture1.Visible = True
  446.         End If
  447.     Case 1
  448.         Disp
  449.         Picture2.Visible = False
  450.         Picture1.Visible = True
  451.         SetTxt (False)
  452. End Select
  453. End Sub
  454. Private Sub Command1_Click()
  455. Unload Me
  456. End Sub
  457. Private Sub Form_Load()
  458. Set db = Workspaces(0).OpenDatabase("DatabaseData.mdb", False)
  459. Set rst = db.OpenRecordset("Book", dbOpenTable)
  460. rst.Index = "图书编号"
  461. Set db1 = Workspaces(0).OpenDatabase("DatabaseData.mdb", False)
  462. Set rst1 = db1.OpenRecordset("Type", dbOpenTable)
  463. Rec = rst.RecordCount
  464. If Rec = 0 Then
  465.     Toolbar1.Enabled = False
  466.     SetTxt (False)
  467. End If
  468. SetTxt (False)
  469. rst.MoveFirst
  470. Disp
  471. TypeAdd
  472. Picture1.Visible = True
  473. Picture2.Visible = False
  474. NumFlag = False
  475. End Sub
  476. Private Sub Disp()
  477. txtBookNum = rst.Fields("图书编号") & vbNullString
  478. txtBookName = rst.Fields("书名") & vbNullString
  479. txtCost = rst.Fields("价格") & Empty
  480. txtBookChu = rst.Fields("出版社") & vbNullString
  481. Combo1.Text = rst.Fields("类别") & vbNullString
  482. End Sub
  483. Private Sub Kong()
  484. txtBookNum = ""
  485. txtBookName = ""
  486. txtbookcost = ""
  487. txtBookChu = ""
  488. Combo1.Text = ""
  489. End Sub
  490. Private Sub SetTxt(Bool As Boolean)
  491. txtBookNum.Enabled = Bool
  492. txtCost.Enabled = Bool
  493. txtBookName.Enabled = Bool
  494. txtBookChu.Enabled = Bool
  495. Combo1.Enabled = Bool
  496. End Sub
  497. Private Sub Form_Unload(Cancel As Integer)
  498. rst.Close
  499. rst1.Close
  500. db1.Close
  501. db.Close
  502. End Sub
  503. Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
  504. Select Case Button.Index
  505.     Case 1
  506.         rst.MoveFirst
  507.         Disp
  508.     Case 2
  509.         rst.MovePrevious
  510.         If rst.BOF Then
  511.             rst.MoveNext
  512.             Exit Sub
  513.         End If
  514.         Disp
  515.     Case 3
  516.         rst.MoveNext
  517.         If rst.EOF Then
  518.             rst.MovePrevious
  519.             Exit Sub
  520.         End If
  521.         Disp
  522.     Case 4
  523.         rst.MoveLast
  524.         Disp
  525.     Case 10
  526.         StrFlag = "修改"
  527.         SetTxt (True)
  528.         labFlag.Caption = "您确实要修改当前记录吗?"
  529.         Picture1.Visible = False
  530.         Picture2.Visible = True
  531.     Case 11
  532.         StrFlag = "删除"
  533.         labFlag.Caption = "您确实要删除当前记录吗?"
  534.         Picture1.Visible = False
  535.         Picture2.Visible = True
  536.     Case 12
  537.         SearchNum.Show (1)
  538.         If SearchFlag = True Then
  539.             rst.Seek "=", BookBianHao
  540.             If rst.NoMatch Then
  541.                 MsgBox "没有此图书编号!", 0 + 48, "查找失败"
  542.                 Exit Sub
  543.             End If
  544.             Disp
  545.             SearchFlag = False
  546.         End If
  547. End Select
  548. End Sub
  549. Private Sub WriteIn()
  550. rst.Fields("图书编号") = txtBookNum
  551. rst.Fields("书名") = txtBookName
  552. rst.Fields("价格") = Val(txtCost)
  553. rst.Fields("出版社") = txtBookChu
  554. rst.Fields("类别") = Combo1.Text
  555. End Sub
  556. Private Sub TypeAdd()
  557. rst1.MoveLast
  558. rst1.MoveFirst
  559. For i = 1 To rst1.RecordCount
  560.     Combo1.AddItem rst1.Fields("类别")
  561.     rst1.MoveNext
  562.     If rst1.EOF Then Exit Sub
  563. Next
  564. End Sub