home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / CODE_UPLOAD1160611122000.psc / Database.frm (.txt) next >
Encoding:
Visual Basic Form  |  2000-11-12  |  18.9 KB  |  557 lines

  1. VERSION 5.00
  2. Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
  3. Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
  4. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  5. Begin VB.Form Form1 
  6.    Caption         =   "Form1"
  7.    ClientHeight    =   6405
  8.    ClientLeft      =   60
  9.    ClientTop       =   345
  10.    ClientWidth     =   7095
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   6405
  13.    ScaleWidth      =   7095
  14.    StartUpPosition =   3  'Windows Default
  15.    Begin MSComctlLib.ImageCombo ImageCombo1 
  16.       Height          =   330
  17.       Left            =   360
  18.       TabIndex        =   10
  19.       Top             =   5760
  20.       Width           =   2055
  21.       _ExtentX        =   3625
  22.       _ExtentY        =   582
  23.       _Version        =   393216
  24.       ForeColor       =   -2147483640
  25.       BackColor       =   -2147483643
  26.       Text            =   "ImageCombo1"
  27.       ImageList       =   "ImageList1"
  28.    End
  29.    Begin MSComctlLib.ImageList ImageList1 
  30.       Left            =   5640
  31.       Top             =   5040
  32.       _ExtentX        =   1005
  33.       _ExtentY        =   1005
  34.       BackColor       =   -2147483643
  35.       ImageWidth      =   16
  36.       ImageHeight     =   16
  37.       MaskColor       =   12632256
  38.       _Version        =   393216
  39.       BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
  40.          NumListImages   =   2
  41.          BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  42.             Picture         =   "Database.frx":0000
  43.             Key             =   "has"
  44.          EndProperty
  45.          BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
  46.             Picture         =   "Database.frx":7175
  47.             Key             =   "hasan"
  48.          EndProperty
  49.       EndProperty
  50.    End
  51.    Begin VB.CommandButton Command3 
  52.       Caption         =   "Remove"
  53.       Height          =   255
  54.       Left            =   4200
  55.       TabIndex        =   9
  56.       Top             =   5280
  57.       Width           =   975
  58.    End
  59.    Begin VB.ComboBox Combo1 
  60.       Height          =   315
  61.       Left            =   120
  62.       TabIndex        =   8
  63.       Top             =   5280
  64.       Width           =   1455
  65.    End
  66.    Begin VB.CommandButton Command2 
  67.       Caption         =   "Change"
  68.       Height          =   255
  69.       Left            =   3120
  70.       TabIndex        =   7
  71.       Top             =   5280
  72.       Width           =   975
  73.    End
  74.    Begin VB.TextBox Text3 
  75.       Height          =   285
  76.       Left            =   1560
  77.       TabIndex        =   6
  78.       Top             =   5280
  79.       Width           =   1455
  80.    End
  81.    Begin MSDataGridLib.DataGrid DataGrid1 
  82.       Bindings        =   "Database.frx":E96F
  83.       Height          =   3735
  84.       Left            =   0
  85.       TabIndex        =   5
  86.       Top             =   840
  87.       Width           =   6735
  88.       _ExtentX        =   11880
  89.       _ExtentY        =   6588
  90.       _Version        =   393216
  91.       AllowUpdate     =   0   'False
  92.       HeadLines       =   1
  93.       RowHeight       =   15
  94.       FormatLocked    =   -1  'True
  95.       BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  96.          Name            =   "MS Sans Serif"
  97.          Size            =   8.25
  98.          Charset         =   0
  99.          Weight          =   400
  100.          Underline       =   0   'False
  101.          Italic          =   0   'False
  102.          Strikethrough   =   0   'False
  103.       EndProperty
  104.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  105.          Name            =   "MS Sans Serif"
  106.          Size            =   8.25
  107.          Charset         =   0
  108.          Weight          =   400
  109.          Underline       =   0   'False
  110.          Italic          =   0   'False
  111.          Strikethrough   =   0   'False
  112.       EndProperty
  113.       ColumnCount     =   18
  114.       BeginProperty Column00 
  115.          DataField       =   "EmployeeID"
  116.          Caption         =   "EmployeeID"
  117.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  118.             Type            =   0
  119.             Format          =   ""
  120.             HaveTrueFalseNull=   0
  121.             FirstDayOfWeek  =   0
  122.             FirstWeekOfYear =   0
  123.             LCID            =   1033
  124.             SubFormatType   =   0
  125.          EndProperty
  126.       EndProperty
  127.       BeginProperty Column01 
  128.          DataField       =   "LastName"
  129.          Caption         =   "LastName"
  130.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  131.             Type            =   0
  132.             Format          =   ""
  133.             HaveTrueFalseNull=   0
  134.             FirstDayOfWeek  =   0
  135.             FirstWeekOfYear =   0
  136.             LCID            =   1033
  137.             SubFormatType   =   0
  138.          EndProperty
  139.       EndProperty
  140.       BeginProperty Column02 
  141.          DataField       =   "FirstName"
  142.          Caption         =   "FirstName"
  143.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  144.             Type            =   0
  145.             Format          =   ""
  146.             HaveTrueFalseNull=   0
  147.             FirstDayOfWeek  =   0
  148.             FirstWeekOfYear =   0
  149.             LCID            =   1033
  150.             SubFormatType   =   0
  151.          EndProperty
  152.       EndProperty
  153.       BeginProperty Column03 
  154.          DataField       =   "Title"
  155.          Caption         =   "Title"
  156.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  157.             Type            =   0
  158.             Format          =   ""
  159.             HaveTrueFalseNull=   0
  160.             FirstDayOfWeek  =   0
  161.             FirstWeekOfYear =   0
  162.             LCID            =   1033
  163.             SubFormatType   =   0
  164.          EndProperty
  165.       EndProperty
  166.       BeginProperty Column04 
  167.          DataField       =   "TitleOfCourtesy"
  168.          Caption         =   "TitleOfCourtesy"
  169.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  170.             Type            =   0
  171.             Format          =   ""
  172.             HaveTrueFalseNull=   0
  173.             FirstDayOfWeek  =   0
  174.             FirstWeekOfYear =   0
  175.             LCID            =   1033
  176.             SubFormatType   =   0
  177.          EndProperty
  178.       EndProperty
  179.       BeginProperty Column05 
  180.          DataField       =   "BirthDate"
  181.          Caption         =   "BirthDate"
  182.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  183.             Type            =   0
  184.             Format          =   ""
  185.             HaveTrueFalseNull=   0
  186.             FirstDayOfWeek  =   0
  187.             FirstWeekOfYear =   0
  188.             LCID            =   1033
  189.             SubFormatType   =   0
  190.          EndProperty
  191.       EndProperty
  192.       BeginProperty Column06 
  193.          DataField       =   "HireDate"
  194.          Caption         =   "HireDate"
  195.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  196.             Type            =   0
  197.             Format          =   ""
  198.             HaveTrueFalseNull=   0
  199.             FirstDayOfWeek  =   0
  200.             FirstWeekOfYear =   0
  201.             LCID            =   1033
  202.             SubFormatType   =   0
  203.          EndProperty
  204.       EndProperty
  205.       BeginProperty Column07 
  206.          DataField       =   "Address"
  207.          Caption         =   "Address"
  208.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  209.             Type            =   0
  210.             Format          =   ""
  211.             HaveTrueFalseNull=   0
  212.             FirstDayOfWeek  =   0
  213.             FirstWeekOfYear =   0
  214.             LCID            =   1033
  215.             SubFormatType   =   0
  216.          EndProperty
  217.       EndProperty
  218.       BeginProperty Column08 
  219.          DataField       =   "City"
  220.          Caption         =   "City"
  221.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  222.             Type            =   0
  223.             Format          =   ""
  224.             HaveTrueFalseNull=   0
  225.             FirstDayOfWeek  =   0
  226.             FirstWeekOfYear =   0
  227.             LCID            =   1033
  228.             SubFormatType   =   0
  229.          EndProperty
  230.       EndProperty
  231.       BeginProperty Column09 
  232.          DataField       =   "Region"
  233.          Caption         =   "Region"
  234.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  235.             Type            =   0
  236.             Format          =   ""
  237.             HaveTrueFalseNull=   0
  238.             FirstDayOfWeek  =   0
  239.             FirstWeekOfYear =   0
  240.             LCID            =   1033
  241.             SubFormatType   =   0
  242.          EndProperty
  243.       EndProperty
  244.       BeginProperty Column10 
  245.          DataField       =   "PostalCode"
  246.          Caption         =   "PostalCode"
  247.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  248.             Type            =   0
  249.             Format          =   ""
  250.             HaveTrueFalseNull=   0
  251.             FirstDayOfWeek  =   0
  252.             FirstWeekOfYear =   0
  253.             LCID            =   1033
  254.             SubFormatType   =   0
  255.          EndProperty
  256.       EndProperty
  257.       BeginProperty Column11 
  258.          DataField       =   "Country"
  259.          Caption         =   "Country"
  260.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  261.             Type            =   0
  262.             Format          =   ""
  263.             HaveTrueFalseNull=   0
  264.             FirstDayOfWeek  =   0
  265.             FirstWeekOfYear =   0
  266.             LCID            =   1033
  267.             SubFormatType   =   0
  268.          EndProperty
  269.       EndProperty
  270.       BeginProperty Column12 
  271.          DataField       =   "HomePhone"
  272.          Caption         =   "HomePhone"
  273.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  274.             Type            =   0
  275.             Format          =   ""
  276.             HaveTrueFalseNull=   0
  277.             FirstDayOfWeek  =   0
  278.             FirstWeekOfYear =   0
  279.             LCID            =   1033
  280.             SubFormatType   =   0
  281.          EndProperty
  282.       EndProperty
  283.       BeginProperty Column13 
  284.          DataField       =   "Extension"
  285.          Caption         =   "Extension"
  286.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  287.             Type            =   0
  288.             Format          =   ""
  289.             HaveTrueFalseNull=   0
  290.             FirstDayOfWeek  =   0
  291.             FirstWeekOfYear =   0
  292.             LCID            =   1033
  293.             SubFormatType   =   0
  294.          EndProperty
  295.       EndProperty
  296.       BeginProperty Column14 
  297.          DataField       =   "Photo"
  298.          Caption         =   "Photo"
  299.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  300.             Type            =   0
  301.             Format          =   ""
  302.             HaveTrueFalseNull=   0
  303.             FirstDayOfWeek  =   0
  304.             FirstWeekOfYear =   0
  305.             LCID            =   1033
  306.             SubFormatType   =   0
  307.          EndProperty
  308.       EndProperty
  309.       BeginProperty Column15 
  310.          DataField       =   "Notes"
  311.          Caption         =   "Notes"
  312.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  313.             Type            =   0
  314.             Format          =   ""
  315.             HaveTrueFalseNull=   0
  316.             FirstDayOfWeek  =   0
  317.             FirstWeekOfYear =   0
  318.             LCID            =   1033
  319.             SubFormatType   =   0
  320.          EndProperty
  321.       EndProperty
  322.       BeginProperty Column16 
  323.          DataField       =   "ReportsTo"
  324.          Caption         =   "ReportsTo"
  325.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  326.             Type            =   0
  327.             Format          =   ""
  328.             HaveTrueFalseNull=   0
  329.             FirstDayOfWeek  =   0
  330.             FirstWeekOfYear =   0
  331.             LCID            =   1033
  332.             SubFormatType   =   0
  333.          EndProperty
  334.       EndProperty
  335.       BeginProperty Column17 
  336.          DataField       =   "PhotoPath"
  337.          Caption         =   "PhotoPath"
  338.          BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
  339.             Type            =   0
  340.             Format          =   ""
  341.             HaveTrueFalseNull=   0
  342.             FirstDayOfWeek  =   0
  343.             FirstWeekOfYear =   0
  344.             LCID            =   1033
  345.             SubFormatType   =   0
  346.          EndProperty
  347.       EndProperty
  348.       SplitCount      =   1
  349.       BeginProperty Split0 
  350.          BeginProperty Column00 
  351.             ColumnWidth     =   929.764
  352.          EndProperty
  353.          BeginProperty Column01 
  354.             ColumnWidth     =   1739.906
  355.          EndProperty
  356.          BeginProperty Column02 
  357.             ColumnWidth     =   1140.095
  358.          EndProperty
  359.          BeginProperty Column03 
  360.             ColumnWidth     =   1739.906
  361.          EndProperty
  362.          BeginProperty Column04 
  363.             ColumnWidth     =   1739.906
  364.          EndProperty
  365.          BeginProperty Column05 
  366.             ColumnWidth     =   1739.906
  367.          EndProperty
  368.          BeginProperty Column06 
  369.             ColumnWidth     =   1739.906
  370.          EndProperty
  371.          BeginProperty Column07 
  372.             ColumnWidth     =   1739.906
  373.          EndProperty
  374.          BeginProperty Column08 
  375.          EndProperty
  376.          BeginProperty Column09 
  377.          EndProperty
  378.          BeginProperty Column10 
  379.             ColumnWidth     =   1140.095
  380.          EndProperty
  381.          BeginProperty Column11 
  382.          EndProperty
  383.          BeginProperty Column12 
  384.             ColumnWidth     =   1739.906
  385.          EndProperty
  386.          BeginProperty Column13 
  387.             ColumnWidth     =   764.787
  388.          EndProperty
  389.          BeginProperty Column14 
  390.             ColumnWidth     =   1739.906
  391.          EndProperty
  392.          BeginProperty Column15 
  393.             ColumnWidth     =   1739.906
  394.          EndProperty
  395.          BeginProperty Column16 
  396.             ColumnWidth     =   915.024
  397.          EndProperty
  398.          BeginProperty Column17 
  399.             ColumnWidth     =   1739.906
  400.          EndProperty
  401.       EndProperty
  402.    End
  403.    Begin VB.CommandButton Command1 
  404.       Caption         =   "add new"
  405.       Height          =   255
  406.       Left            =   3000
  407.       TabIndex        =   2
  408.       Top             =   360
  409.       Width           =   975
  410.    End
  411.    Begin VB.TextBox Text2 
  412.       DataField       =   "LastName"
  413.       DataSource      =   "Adodc1"
  414.       Height          =   285
  415.       Left            =   1080
  416.       TabIndex        =   1
  417.       Top             =   480
  418.       Width           =   1695
  419.    End
  420.    Begin VB.TextBox Text1 
  421.       DataField       =   "FirstName"
  422.       DataSource      =   "Adodc1"
  423.       Height          =   285
  424.       Left            =   1080
  425.       TabIndex        =   0
  426.       Top             =   120
  427.       Width           =   1695
  428.    End
  429.    Begin MSAdodcLib.Adodc Adodc1 
  430.       Height          =   330
  431.       Left            =   1680
  432.       Top             =   4800
  433.       Width           =   2655
  434.       _ExtentX        =   4683
  435.       _ExtentY        =   582
  436.       ConnectMode     =   0
  437.       CursorLocation  =   3
  438.       IsolationLevel  =   -1
  439.       ConnectionTimeout=   15
  440.       CommandTimeout  =   30
  441.       CursorType      =   3
  442.       LockType        =   3
  443.       CommandType     =   2
  444.       CursorOptions   =   0
  445.       CacheSize       =   50
  446.       MaxRecords      =   0
  447.       BOFAction       =   0
  448.       EOFAction       =   0
  449.       ConnectStringType=   1
  450.       Appearance      =   1
  451.       BackColor       =   -2147483643
  452.       ForeColor       =   -2147483640
  453.       Orientation     =   0
  454.       Enabled         =   -1
  455.       Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Northwind;Data Source=hasan"
  456.       OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=Northwind;Data Source=hasan"
  457.       OLEDBFile       =   ""
  458.       DataSourceName  =   ""
  459.       OtherAttributes =   ""
  460.       UserName        =   ""
  461.       Password        =   ""
  462.       RecordSource    =   "Employees"
  463.       Caption         =   "Employees"
  464.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  465.          Name            =   "MS Sans Serif"
  466.          Size            =   8.25
  467.          Charset         =   0
  468.          Weight          =   400
  469.          Underline       =   0   'False
  470.          Italic          =   0   'False
  471.          Strikethrough   =   0   'False
  472.       EndProperty
  473.       _Version        =   393216
  474.    End
  475.    Begin VB.Label Label2 
  476.       Caption         =   "Last Name"
  477.       Height          =   255
  478.       Left            =   0
  479.       TabIndex        =   4
  480.       Top             =   480
  481.       Width           =   975
  482.    End
  483.    Begin VB.Label Label1 
  484.       Caption         =   "First Name"
  485.       Height          =   255
  486.       Left            =   0
  487.       TabIndex        =   3
  488.       Top             =   120
  489.       Width           =   975
  490.    End
  491. Attribute VB_Name = "Form1"
  492. Attribute VB_GlobalNameSpace = False
  493. Attribute VB_Creatable = False
  494. Attribute VB_PredeclaredId = True
  495. Attribute VB_Exposed = False
  496. Private Sub MoveCombo()
  497.     ' In case of error, hide the ComboBox.
  498.     On Error GoTo Error_Handler
  499.     Dim gcol As MSDataGridLib.Column
  500.     Set gcol = DataGrid1.Columns(DataGrid1.Col)
  501.     If gcol.Caption = "FirstName" And DataGrid1.CurrentCellVisible Then
  502.         ' Move the ComboBox inside the SupplierID column
  503.         ' if it is the current column and it is visible.
  504.         ImageCombo1.Move DataGrid1.Left + gcol.Left, _
  505.             DataGrid1.Top + DataGrid1.RowTop(DataGrid1.Row), gcol.Width
  506.         ImageCombo1.ZOrder
  507.         ImageCombo1.SetFocus
  508.         ImageCombo1.Text = gcol.Text
  509.         Exit Sub
  510.     End If
  511. Error_Handler:
  512.     ' In all other cases, hide the ComboBox.
  513.     If DataGrid1.Visible Then DataGrid1.SetFocus
  514. End Sub
  515. Private Sub imagecombo1_Click()
  516.     ' Change the value of the underlying grid cell.
  517.     DataGrid1.Columns("FirstName").Value = ImageCombo1.Text
  518. End Sub
  519. Private Sub DataGrid1_RowColChange(LastRow As Variant, _
  520.     ByVal LastCol As Integer)
  521.     MoveCombo
  522. End Sub
  523. Private Sub DataGrid1_RowResize(Cancel As Integer)
  524.     MoveCombo
  525. End Sub
  526. Private Sub DataGrid1_ColResize(ByVal ColIndex As Integer, _
  527.     Cancel As Integer)
  528.     MoveCombo
  529. End Sub
  530. Private Sub DataGrid1_Scroll(Cancel As Integer)
  531.     MoveCombo
  532. End Sub
  533. Private Sub DataGrid1_SplitChange()
  534.     MoveCombo
  535. End Sub
  536. Private Sub Command1_Click()
  537. Adodc1.Recordset.AddNew
  538. End Sub
  539. Private Sub Command2_Click()
  540. DataGrid1.Columns(Combo1.Text).Text = Text3.Text
  541. End Sub
  542. Private Sub Command3_Click()
  543. Adodc1.Recordset.Delete adAffectCurrent
  544. End Sub
  545. Private Sub Form_Load()
  546. Set ImageCombo1.ImageList = ImageList1
  547. ImageCombo1.ComboItems.Add , , "hasan", "has"
  548. ImageCombo1.ComboItems.Add , , "said", "hasan"
  549. ImageCombo1.ComboItems.Add , , "lina", "hasan"
  550. ImageCombo1.ComboItems.Add , , "rana", "hasan"
  551. DataGrid1.RowHeight = ImageCombo1.Height
  552. x = Adodc1.Recordset.RecordCount
  553. MsgBox x
  554. Combo1.AddItem ("FirstName")
  555. Combo1.AddItem ("LastName")
  556. End Sub
  557.