home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 4 Unleashed / Visual_Basic_4_Unleashed_SAMS_Publishing_1995.iso / source / chap36 / addprj.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-09-19  |  3.4 KB  |  120 lines

  1. VERSION 4.00
  2. Begin VB.Form frmAddProject 
  3.    Caption         =   "Add Project"
  4.    ClientHeight    =   3690
  5.    ClientLeft      =   1350
  6.    ClientTop       =   2085
  7.    ClientWidth     =   6585
  8.    ControlBox      =   0   'False
  9.    Height          =   4095
  10.    Left            =   1290
  11.    LinkTopic       =   "Form1"
  12.    LockControls    =   -1  'True
  13.    MaxButton       =   0   'False
  14.    MinButton       =   0   'False
  15.    ScaleHeight     =   3690
  16.    ScaleWidth      =   6585
  17.    Top             =   1740
  18.    Width           =   6705
  19.    Begin VB.CommandButton cmdCancel 
  20.       Caption         =   "&Cancel"
  21.       Height          =   465
  22.       Left            =   5130
  23.       TabIndex        =   3
  24.       Top             =   600
  25.       Width           =   1245
  26.    End
  27.    Begin VB.CommandButton cmdSave 
  28.       Caption         =   "&Save"
  29.       Height          =   465
  30.       Left            =   5130
  31.       TabIndex        =   2
  32.       Top             =   90
  33.       Width           =   1245
  34.    End
  35.    Begin VB.TextBox txtName 
  36.       Height          =   285
  37.       Left            =   210
  38.       TabIndex        =   0
  39.       Top             =   450
  40.       Width           =   4095
  41.    End
  42.    Begin VB.Data dbaProject 
  43.       Caption         =   "Project"
  44.       Connect         =   "Access"
  45.       DatabaseName    =   "c:\sams\maketeam"
  46.       Exclusive       =   -1  'True
  47.       Height          =   300
  48.       Left            =   0
  49.       Options         =   0
  50.       ReadOnly        =   0   'False
  51.       RecordsetType   =   1  'Dynaset
  52.       RecordSource    =   "qryProject"
  53.       Top             =   60
  54.       Visible         =   0   'False
  55.       Width           =   3255
  56.    End
  57.    Begin RichtextLib.RichTextBox txtDetail 
  58.       DataField       =   "Name"
  59.       DataSource      =   "dbaProject"
  60.       Height          =   2235
  61.       Left            =   210
  62.       TabIndex        =   1
  63.       Top             =   1260
  64.       Width           =   6165
  65.       _Version        =   65536
  66.       _ExtentX        =   10874
  67.       _ExtentY        =   3942
  68.       _StockProps     =   69
  69.       BackColor       =   -2147483643
  70.       TextRTF         =   $"AddPrj.frx":0000
  71.    End
  72. Attribute VB_Name = "frmAddProject"
  73. Attribute VB_Creatable = False
  74. Attribute VB_Exposed = False
  75. Option Explicit
  76. Sub PrepForm()
  77.   If gAction = 1 Then
  78.     'Add
  79.     frmAddProject.Caption = "Add New Project"
  80.     txtName = ""
  81.     txtDetail = ""
  82.   Else
  83.     'Edit
  84.     frmAddProject.Caption = "Edit a Project"
  85.     dbaProject.Recordset.FindFirst "ProjectKey=" + gProjectKey
  86.     txtName = dbaProject.Recordset![Name]
  87.     txtDetail = dbaProject.Recordset![Detail]
  88.   End If
  89. End Sub
  90. Private Sub cmdCancel_Click()
  91.   gAction = -gAction
  92.   Unload frmAddProject
  93. End Sub
  94. Private Sub cmdSave_Click()
  95.   If Len(Trim(txtName)) < 1 Then
  96.     MsgBox "Must enter a name.", 48, gProgramTitle
  97.     txtName.SetFocus
  98.     Exit Sub
  99.   End If
  100.   If gAction = 1 Then
  101.     dbaProject.Recordset.AddNew
  102.   Else
  103.     dbaProject.Recordset.Edit
  104.   End If
  105.   dbaProject.Recordset![Name] = txtName
  106.   dbaProject.Recordset![Detail] = txtDetail
  107.   dbaProject.Recordset![LastUpdate] = Now
  108.   dbaProject.UpdateRecord
  109.   gAction = 0
  110.   Unload frmAddProject
  111. End Sub
  112. Private Sub Form_Load()
  113.   Left = (Screen.Width - Width) / 2
  114.   TOP = (Screen.Height - Height) / 2
  115.   MousePointer = 0
  116.   dbaProject.DatabaseName = gMainDBName
  117.   dbaProject.Refresh
  118.   PrepForm
  119. End Sub
  120.