frmshow.frm
上传用户:plkplk66
上传日期:2007-06-06
资源大小:686k
文件大小:13k
源码类别:

其他行业

开发平台:

Visual Basic

  1. VERSION 5.00
  2. Begin VB.Form frmstudent 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "学生信息录入"
  5.    ClientHeight    =   7320
  6.    ClientLeft      =   5250
  7.    ClientTop       =   690
  8.    ClientWidth     =   5970
  9.    LinkTopic       =   "Form2"
  10.    MaxButton       =   0   'False
  11.    ScaleHeight     =   7320
  12.    ScaleWidth      =   5970
  13.    Begin VB.CommandButton cmdcancel 
  14.       Caption         =   "取消"
  15.       Height          =   375
  16.       Left            =   3360
  17.       TabIndex        =   32
  18.       Top             =   6825
  19.       Width           =   975
  20.    End
  21.    Begin VB.CommandButton cmdok 
  22.       Caption         =   "确定"
  23.       Height          =   375
  24.       Left            =   1575
  25.       TabIndex        =   28
  26.       Top             =   6825
  27.       Width           =   975
  28.    End
  29.    Begin VB.Frame Frame1 
  30.       Caption         =   "个人信息"
  31.       Height          =   6495
  32.       Left            =   210
  33.       TabIndex        =   0
  34.       Top             =   210
  35.       Width           =   5520
  36.       Begin VB.TextBox txtage 
  37.          Appearance      =   0  'Flat
  38.          Height          =   300
  39.          Left            =   2415
  40.          TabIndex        =   30
  41.          Top             =   1920
  42.          Width           =   645
  43.       End
  44.       Begin VB.Frame Frame3 
  45.          Caption         =   "备注"
  46.          Height          =   1455
  47.          Left            =   240
  48.          TabIndex        =   26
  49.          Top             =   4800
  50.          Width           =   5055
  51.          Begin VB.TextBox txtremark 
  52.             Height          =   1095
  53.             Left            =   120
  54.             MultiLine       =   -1  'True
  55.             ScrollBars      =   2  'Vertical
  56.             TabIndex        =   27
  57.             Top             =   240
  58.             Width           =   4710
  59.          End
  60.       End
  61.       Begin VB.TextBox txtweight 
  62.          Appearance      =   0  'Flat
  63.          Height          =   270
  64.          Left            =   3600
  65.          TabIndex        =   24
  66.          Top             =   4320
  67.          Width           =   615
  68.       End
  69.       Begin VB.TextBox txtheight 
  70.          Appearance      =   0  'Flat
  71.          Height          =   270
  72.          Left            =   960
  73.          TabIndex        =   21
  74.          Top             =   4320
  75.          Width           =   615
  76.       End
  77.       Begin VB.TextBox txtpostcode 
  78.          Appearance      =   0  'Flat
  79.          Height          =   270
  80.          Left            =   3735
  81.          TabIndex        =   19
  82.          Top             =   2880
  83.          Width           =   1320
  84.       End
  85.       Begin VB.TextBox txtdepartment 
  86.          Appearance      =   0  'Flat
  87.          Height          =   270
  88.          Left            =   960
  89.          TabIndex        =   17
  90.          Top             =   1440
  91.          Width           =   1335
  92.       End
  93.       Begin VB.TextBox txtID 
  94.          Appearance      =   0  'Flat
  95.          Height          =   270
  96.          Left            =   960
  97.          TabIndex        =   15
  98.          Top             =   960
  99.          Width           =   1335
  100.       End
  101.       Begin VB.ComboBox cmbcity 
  102.          Appearance      =   0  'Flat
  103.          Height          =   300
  104.          Left            =   1920
  105.          TabIndex        =   13
  106.          Text            =   "慈溪"
  107.          Top             =   2400
  108.          Width           =   735
  109.       End
  110.       Begin VB.ComboBox cmbprovince 
  111.          Appearance      =   0  'Flat
  112.          Height          =   300
  113.          Left            =   960
  114.          TabIndex        =   12
  115.          Text            =   "浙江"
  116.          Top             =   2400
  117.          Width           =   735
  118.       End
  119.       Begin VB.ComboBox cmbsex 
  120.          Appearance      =   0  'Flat
  121.          Height          =   300
  122.          Left            =   960
  123.          TabIndex        =   11
  124.          Text            =   "男"
  125.          Top             =   1920
  126.          Width           =   645
  127.       End
  128.       Begin VB.TextBox txtname 
  129.          Appearance      =   0  'Flat
  130.          Height          =   270
  131.          Left            =   960
  132.          TabIndex        =   4
  133.          Top             =   525
  134.          Width           =   1335
  135.       End
  136.       Begin VB.TextBox txtphone 
  137.          Appearance      =   0  'Flat
  138.          Height          =   270
  139.          Left            =   960
  140.          TabIndex        =   3
  141.          Top             =   2880
  142.          Width           =   1335
  143.       End
  144.       Begin VB.TextBox txtaddress 
  145.          Appearance      =   0  'Flat
  146.          Height          =   270
  147.          Left            =   960
  148.          TabIndex        =   2
  149.          Top             =   3360
  150.          Width           =   4095
  151.       End
  152.       Begin VB.TextBox txtemail 
  153.          Appearance      =   0  'Flat
  154.          Height          =   270
  155.          Left            =   960
  156.          TabIndex        =   1
  157.          Top             =   3840
  158.          Width           =   4095
  159.       End
  160.       Begin VB.Label Label16 
  161.          Caption         =   "点击此处添加照片"
  162.          Height          =   435
  163.          Left            =   3990
  164.          TabIndex        =   33
  165.          Top             =   1155
  166.          Width           =   750
  167.       End
  168.       Begin VB.Label Label15 
  169.          Caption         =   "岁"
  170.          Height          =   225
  171.          Left            =   3255
  172.          TabIndex        =   31
  173.          Top             =   1950
  174.          Width           =   225
  175.       End
  176.       Begin VB.Label Label14 
  177.          Caption         =   "年龄:"
  178.          Height          =   225
  179.          Left            =   1890
  180.          TabIndex        =   29
  181.          Top             =   1950
  182.          Width           =   540
  183.       End
  184.       Begin VB.Image Image1 
  185.          BorderStyle     =   1  'Fixed Single
  186.          Height          =   1695
  187.          Left            =   3675
  188.          Stretch         =   -1  'True
  189.          Top             =   525
  190.          Width           =   1380
  191.       End
  192.       Begin VB.Label Label13 
  193.          Caption         =   "kg"
  194.          Height          =   255
  195.          Left            =   4320
  196.          TabIndex        =   25
  197.          Top             =   4320
  198.          Width           =   255
  199.       End
  200.       Begin VB.Label Label12 
  201.          Caption         =   "体重:"
  202.          Height          =   255
  203.          Left            =   3000
  204.          TabIndex        =   23
  205.          Top             =   4320
  206.          Width           =   615
  207.       End
  208.       Begin VB.Label Label11 
  209.          Caption         =   "cm"
  210.          Height          =   255
  211.          Left            =   1680
  212.          TabIndex        =   22
  213.          Top             =   4320
  214.          Width           =   255
  215.       End
  216.       Begin VB.Label Label10 
  217.          Caption         =   "身高:"
  218.          Height          =   255
  219.          Left            =   240
  220.          TabIndex        =   20
  221.          Top             =   4320
  222.          Width           =   615
  223.       End
  224.       Begin VB.Label Label9 
  225.          Caption         =   "邮编:"
  226.          Height          =   255
  227.          Left            =   3045
  228.          TabIndex        =   18
  229.          Top             =   2880
  230.          Width           =   735
  231.       End
  232.       Begin VB.Label Label8 
  233.          Caption         =   "系别:"
  234.          Height          =   255
  235.          Left            =   240
  236.          TabIndex        =   16
  237.          Top             =   1440
  238.          Width           =   615
  239.       End
  240.       Begin VB.Label Label1 
  241.          Caption         =   "学号:"
  242.          Height          =   255
  243.          Left            =   240
  244.          TabIndex        =   14
  245.          Top             =   960
  246.          Width           =   615
  247.       End
  248.       Begin VB.Label Label7 
  249.          Caption         =   "E-MAIL:"
  250.          Height          =   255
  251.          Left            =   240
  252.          TabIndex        =   10
  253.          Top             =   3840
  254.          Width           =   735
  255.       End
  256.       Begin VB.Label Label6 
  257.          Caption         =   "地址:"
  258.          Height          =   255
  259.          Left            =   240
  260.          TabIndex        =   9
  261.          Top             =   3360
  262.          Width           =   615
  263.       End
  264.       Begin VB.Label Label5 
  265.          Caption         =   "电话:"
  266.          Height          =   255
  267.          Left            =   240
  268.          TabIndex        =   8
  269.          Top             =   2880
  270.          Width           =   615
  271.       End
  272.       Begin VB.Label Label4 
  273.          Caption         =   "籍贯:"
  274.          Height          =   255
  275.          Left            =   240
  276.          TabIndex        =   7
  277.          Top             =   2400
  278.          Width           =   735
  279.       End
  280.       Begin VB.Label Label3 
  281.          Caption         =   "性别:"
  282.          Height          =   255
  283.          Left            =   240
  284.          TabIndex        =   6
  285.          Top             =   1920
  286.          Width           =   615
  287.       End
  288.       Begin VB.Label Label2 
  289.          Caption         =   "姓名:"
  290.          Height          =   255
  291.          Left            =   240
  292.          TabIndex        =   5
  293.          Top             =   480
  294.          Width           =   615
  295.       End
  296.    End
  297.    Begin VB.Data Data1 
  298.       Caption         =   "Data1"
  299.       Connect         =   "Access"
  300.       DatabaseName    =   "C:Documents and SettingsbillMy Documents我的数据源通讯录97.mdb"
  301.       DefaultCursorType=   0  '缺省游标
  302.       DefaultType     =   2  '使用 ODBC
  303.       Exclusive       =   0   'False
  304.       Height          =   375
  305.       Left            =   2160
  306.       Options         =   0
  307.       ReadOnly        =   0   'False
  308.       RecordsetType   =   0  'Table
  309.       RecordSource    =   "通讯录"
  310.       Top             =   3840
  311.       Width           =   3135
  312.    End
  313. End
  314. Attribute VB_Name = "frmstudent"
  315. Attribute VB_GlobalNameSpace = False
  316. Attribute VB_Creatable = False
  317. Attribute VB_PredeclaredId = True
  318. Attribute VB_Exposed = False
  319. Option Explicit
  320. Private Sub cmdcancel_Click()
  321. frmmain.Enabled = True
  322. frmmain.SetFocus
  323. Unload Me
  324. End Sub
  325. Private Sub cmdok_Click()
  326. Dim fg As Integer
  327. Set rs = db.OpenRecordset("SELECT * FROM reshi")
  328. If rs Is Nothing Or rs.Updatable = False Then
  329.    MsgBox "不能打开或写入记录集!"
  330.    Exit Sub
  331. End If
  332. rs.AddNew
  333. DataFile = 1
  334. If FNAME <> "" Then
  335. Open FNAME For Binary Access Read As DataFile
  336. Fl = LOF(DataFile)
  337.  If Fl = 0 Then
  338.         Close DataFile
  339.         Exit Sub
  340.     End If
  341.         block = Fl  blocksize
  342.     Fragment = Fl Mod blocksize
  343.     ReDim Chunk(Fragment)
  344.     Get DataFile, , Chunk()
  345.     rs.Fields("photo").AppendChunk Chunk()
  346.     ReDim Chunk(blocksize)
  347.     For I = 1 To block
  348.         Get DataFile, , Chunk()
  349.         rs.Fields("photo").AppendChunk Chunk()
  350.     Next I
  351. Close DataFile
  352. End If
  353. rs.Fields("name") = txtname.Text
  354. rs.Fields("ID") = txtID.Text
  355. rs.Fields("profession") = txtdepartment.Text
  356. rs.Fields("zip") = txtpostcode.Text
  357. rs.Fields("phone") = txtphone.Text
  358. rs.Fields("sex") = cmbsex.Text
  359. rs.Fields("address") = txtaddress.Text
  360. rs.Fields("height") = Val(txtheight.Text)
  361. rs.Fields("weight") = Val(txtweight.Text)
  362. rs.Fields("location") = cmbprovince.Text + cmbcity.Text
  363. rs.Fields("remark") = txtremark.Text
  364. rs.Fields("email") = txtemail.Text
  365. rs.Fields("age") = Val(txtage.Text)
  366. rs.Fields("flag") = 1
  367. rs.Update
  368. rs.Close
  369. Set rs = Nothing
  370. fg = MsgBox("信息已录入", vbYesNo)
  371. If fg = 6 Then
  372. frmstudent.Enabled = True
  373. frmstudent.Visible = True
  374. Else
  375. Exit Sub
  376. End If
  377. End Sub
  378. Private Sub Form_Load()
  379. cmbsex.AddItem "男"
  380. cmbsex.AddItem "女"
  381. cmbprovince.AddItem "浙江"
  382. cmbcity.AddItem "慈溪"
  383. Set db = Workspaces(0).OpenDatabase(App.Path & "reshi.mdb")
  384. End Sub
  385. Private Sub Image1_Click()
  386. flag = 1
  387. frmloadpic.Visible = True
  388. frmloadpic.File1.Pattern = "*.bmp;*.jpg;*,ico;*.gif"
  389. Me.Enabled = False
  390. End Sub
  391. Private Sub Label16_Click()
  392. flag = 1
  393. frmloadpic.Visible = True
  394. frmloadpic.File1.Pattern = "*.bmp;*.jpg;*,ico;*.gif"
  395. Me.Enabled = False
  396. End Sub
  397. Private Sub cmbprovince_KeyPress(KeyAscii As Integer)
  398. If KeyAscii = 13 Then
  399. cmbcity.SetFocus
  400. End If
  401. End Sub
  402. Private Sub txtaddress_KeyPress(KeyAscii As Integer)
  403. If KeyAscii = 13 Then
  404. txtemail.SetFocus
  405. End If
  406. End Sub
  407. Private Sub txtage_KeyPress(KeyAscii As Integer)
  408. If KeyAscii = 13 Then
  409. cmbprovince.SetFocus
  410. End If
  411. End Sub
  412. Private Sub txtdepartment_KeyPress(KeyAscii As Integer)
  413. If KeyAscii = 13 Then
  414. cmbsex.SetFocus
  415. End If
  416. End Sub
  417. Private Sub txtemail_KeyPress(KeyAscii As Integer)
  418. If KeyAscii = 13 Then
  419. txtheight.SetFocus
  420. End If
  421. End Sub
  422. Private Sub txtheight_KeyPress(KeyAscii As Integer)
  423. If KeyAscii = 13 Then
  424. txtweight.SetFocus
  425. End If
  426. End Sub
  427. Private Sub txtID_KeyPress(KeyAscii As Integer)
  428. If KeyAscii = 13 Then
  429. txtdepartment.SetFocus
  430. End If
  431. End Sub
  432. Private Sub cmbsex_KeyPress(KeyAscii As Integer)
  433. If KeyAscii = 13 Then
  434. txtage.SetFocus
  435. End If
  436. End Sub
  437. Private Sub txtname_KeyPress(KeyAscii As Integer)
  438. If KeyAscii = 13 Then
  439. txtID.SetFocus
  440. End If
  441. End Sub
  442. Private Sub cmbcity_KeyPress(KeyAscii As Integer)
  443. If KeyAscii = 13 Then
  444. txtphone.SetFocus
  445. End If
  446. End Sub
  447. Private Sub txtphone_KeyPress(KeyAscii As Integer)
  448. If KeyAscii = 13 Then
  449. txtpostcode.SetFocus
  450. End If
  451. End Sub
  452. Private Sub txtpostcode_KeyPress(KeyAscii As Integer)
  453. If KeyAscii = 13 Then
  454. txtaddress.SetFocus
  455. End If
  456. End Sub
  457. Private Sub txtremark_KeyPress(KeyAscii As Integer)
  458. If KeyAscii = 13 Then
  459. cmdok.SetFocus
  460. End If
  461. End Sub
  462. Private Sub txtweight_KeyPress(KeyAscii As Integer)
  463. If KeyAscii = 13 Then
  464. txtremark.SetFocus
  465. End If
  466. End Sub