home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / multgrid / form1.frm (.txt) next >
Encoding:
Visual Basic Form  |  1998-08-23  |  3.4 KB  |  110 lines

  1. VERSION 5.00
  2. Object = "{00028C01-0000-0000-0000-000000000046}#1.0#0"; "DBGRID32.OCX"
  3. Begin VB.Form Form1 
  4.    Caption         =   "Bookstore"
  5.    ClientHeight    =   6525
  6.    ClientLeft      =   165
  7.    ClientTop       =   450
  8.    ClientWidth     =   6690
  9.    LinkTopic       =   "Form1"
  10.    ScaleHeight     =   6525
  11.    ScaleWidth      =   6690
  12.    StartUpPosition =   3  'Windows Default
  13.    Begin VB.CommandButton Command3 
  14.       Caption         =   "Copy selected titles to the list window"
  15.       Height          =   315
  16.       Left            =   1680
  17.       TabIndex        =   4
  18.       Top             =   6000
  19.       Width           =   3135
  20.    End
  21.    Begin VB.CommandButton Command2 
  22.       Caption         =   "Exit"
  23.       Height          =   315
  24.       Left            =   5160
  25.       TabIndex        =   3
  26.       Top             =   6000
  27.       Width           =   1215
  28.    End
  29.    Begin VB.CommandButton Command1 
  30.       Caption         =   "Clear"
  31.       Height          =   315
  32.       Left            =   120
  33.       TabIndex        =   2
  34.       Top             =   6000
  35.       Width           =   1215
  36.    End
  37.    Begin VB.Data Data1 
  38.       Caption         =   "Data1"
  39.       Connect         =   "Access"
  40.       DatabaseName    =   "C:\Program Files\DevStudio\VB\Biblio.mdb"
  41.       DefaultCursorType=   0  'DefaultCursor
  42.       DefaultType     =   2  'UseODBC
  43.       Exclusive       =   0   'False
  44.       Height          =   345
  45.       Left            =   120
  46.       Options         =   0
  47.       ReadOnly        =   0   'False
  48.       RecordsetType   =   1  'Dynaset
  49.       RecordSource    =   "Titles"
  50.       Top             =   5520
  51.       Width           =   4335
  52.    End
  53.    Begin VB.ListBox List1 
  54.       Height          =   1425
  55.       Left            =   120
  56.       TabIndex        =   1
  57.       Top             =   3840
  58.       Width           =   6375
  59.    End
  60.    Begin MSDBGrid.DBGrid DBGrid1 
  61.       Bindings        =   "Form1.frx":0000
  62.       Height          =   3495
  63.       Left            =   120
  64.       OleObjectBlob   =   "Form1.frx":0010
  65.       TabIndex        =   0
  66.       Top             =   120
  67.       Width           =   6375
  68.    End
  69. Attribute VB_Name = "Form1"
  70. Attribute VB_GlobalNameSpace = False
  71. Attribute VB_Creatable = False
  72. Attribute VB_PredeclaredId = True
  73. Attribute VB_Exposed = False
  74. Option Explicit
  75. Private Sub Command1_Click()
  76.     List1.Clear         ' Clears the listbox
  77. End Sub
  78. Private Sub Command2_Click()
  79.     Unload Form1
  80.     End                 ' Ends application
  81. End Sub
  82. Private Sub Command3_Click()
  83. Dim SelRecord As Integer
  84. For SelRecord = 0 To DBGrid1.SelBookmarks.Count - 1
  85.     Data1.Recordset.Bookmark = DBGrid1.SelBookmarks(SelRecord)
  86.     List1.AddItem Data1.Recordset(0)
  87. Next SelRecord
  88. End Sub
  89. Private Sub Data1_Reposition()
  90.     ' Assign the Title to the caption property
  91.     Data1.Caption = Data1.Recordset(0)
  92. End Sub
  93. Private Sub DBGrid1_DblClick()
  94.     ' Add the title to the list
  95.     List1.AddItem Data1.Recordset(0)
  96. End Sub
  97. Private Sub DBGrid1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  98. Call GridMultiSelect(Button, Shift, X, Y, DBGrid1, Data1.Recordset)
  99. End Sub
  100. Private Sub Form_Load()
  101. Form1.Width = 9500
  102. End Sub
  103. Private Sub Form_Resize()
  104. Const Spacer As Integer = 125
  105. DBGrid1.Width = (Form1.Width - (Spacer * 2)) - 100
  106. DBGrid1.Left = Spacer
  107. List1.Width = (Form1.Width - (Spacer * 2)) - 100
  108. List1.Left = Spacer
  109. End Sub
  110.