home *** CD-ROM | disk | FTP | other *** search
/ Tools / WinSN5.0Ver.iso / PVb5.0 / VB / SAMPLES / PGUIDE / MSFLEXGD / FFLEX.FRM (.txt) next >
Encoding:
Visual Basic Form  |  1997-01-20  |  6.0 KB  |  195 lines

  1. VERSION 5.00
  2. Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
  3. Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.1#0"; "COMDLG32.OCX"
  4. Begin VB.Form Form1 
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "FlexGrid 
  7.    ClientHeight    =   3930
  8.    ClientLeft      =   1740
  9.    ClientTop       =   1770
  10.    ClientWidth     =   8235
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3930
  15.    ScaleWidth      =   8235
  16.    Begin VB.Data Data1 
  17.       Caption         =   "Data1"
  18.       Connect         =   "Access"
  19.       DatabaseName    =   "C:\Program Files\DevStudio\VB\Biblio.mdb"
  20.       DefaultCursorType=   0  '
  21.       DefaultType     =   2  '
  22.  ODBC
  23.       Exclusive       =   0   'False
  24.       Height          =   375
  25.       Left            =   6360
  26.       Options         =   0
  27.       ReadOnly        =   0   'False
  28.       RecordsetType   =   2  'Snapshot
  29.       RecordSource    =   "Title Author"
  30.       Top             =   3240
  31.       Visible         =   0   'False
  32.       Width           =   1815
  33.    End
  34.    Begin MSFlexGridLib.MSFlexGrid flex 
  35.       Bindings        =   "fFlex.frx":0000
  36.       DragIcon        =   "fFlex.frx":0010
  37.       Height          =   3135
  38.       Left            =   120
  39.       TabIndex        =   0
  40.       Top             =   600
  41.       Width           =   6135
  42.       _ExtentX        =   10821
  43.       _ExtentY        =   5530
  44.       Cols            =   3
  45.       FixedCols       =   0
  46.       BackColorFixed  =   0
  47.       ForeColorFixed  =   16776960
  48.       GridColor       =   -2147483630
  49.       HighLight       =   2
  50.       SelectionMode   =   1
  51.       AllowUserResizing=   1
  52.       BorderStyle     =   0
  53.    End
  54.    Begin MSComDlg.CommonDialog CommonDialog1 
  55.       Left            =   6480
  56.       Top             =   2640
  57.       _ExtentX        =   847
  58.       _ExtentY        =   847
  59.       FontSize        =   8.49966e-19
  60.    End
  61.    Begin VB.Image Image1 
  62.       Height          =   1440
  63.       Left            =   3720
  64.       Picture         =   "fFlex.frx":0452
  65.       Stretch         =   -1  'True
  66.       Top             =   600
  67.       Width           =   4215
  68.    End
  69.    Begin VB.Label Label1 
  70.       Alignment       =   2  'Center
  71.       BackColor       =   &H00FFFFFF&
  72.       BorderStyle     =   1  'Fixed Single
  73.       Caption         =   "
  74.       ForeColor       =   &H00808080&
  75.       Height          =   735
  76.       Left            =   6600
  77.       TabIndex        =   2
  78.       Top             =   0
  79.       Width           =   1335
  80.    End
  81.    Begin VB.Label lblTitle 
  82.       Alignment       =   2  'Center
  83.       BackColor       =   &H00000000&
  84.       Caption         =   "Flex 
  85.       BeginProperty Font 
  86.          Name            =   "
  87.          Size            =   21.75
  88.          Charset         =   134
  89.          Weight          =   700
  90.          Underline       =   0   'False
  91.          Italic          =   0   'False
  92.          Strikethrough   =   0   'False
  93.       EndProperty
  94.       ForeColor       =   &H000000FF&
  95.       Height          =   615
  96.       Left            =   120
  97.       TabIndex        =   1
  98.       Top             =   0
  99.       Width           =   6135
  100.    End
  101. Attribute VB_Name = "Form1"
  102. Attribute VB_GlobalNameSpace = False
  103. Attribute VB_Creatable = False
  104. Attribute VB_PredeclaredId = True
  105. Attribute VB_Exposed = False
  106. Option Explicit
  107. Private Sub flex_DragDrop(Source As VB.Control, X As Single, Y As Single)
  108.     If flex.Tag = "" Then Exit Sub
  109.     flex.Redraw = False
  110.     flex.ColPosition(Val(flex.Tag)) = flex.MouseCol
  111.     DoSort
  112.     flex.Redraw = True
  113. End Sub
  114. Private Sub flex_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
  115.     flex.Tag = ""
  116.     If flex.MouseRow <> 0 Then Exit Sub
  117.     flex.Tag = Str(flex.MouseCol)
  118.     flex.Drag 1
  119. End Sub
  120. Private Sub Form_Load()
  121. On Error GoTo FormLoad_Err
  122.         
  123.   Data1.DatabaseName = CurDir & "\biblio.mdb"
  124.   Data1.Refresh
  125.   flex.Redraw = False
  126.   DoInitialSettings
  127.   DoSql
  128.   DoSort
  129.   flex.Redraw = True
  130. FormLoad_Exit:
  131. Exit Sub
  132. FormLoad_Err:
  133.     '
  134.  3024 
  135.     If Err = 3024 Then
  136.         '
  137.  CommonDialog 
  138.         With CommonDialog1
  139.           .DialogTitle = "
  140.  biblio.mdb 
  141.           .Filter = "(*.mdb)|*.mdb"
  142.           .InitDir = CurDir
  143.           .filename = "biblio.mdb"
  144.           .Flags = cdlOFNExplorer Or cdlOFNFileMustExist Or cdlOFNPathMustExist
  145.           .ShowOpen
  146.           '
  147.           If .filename <> "" Then
  148.             '
  149.  biblio.mdb
  150.             If Right(UCase(.filename), Len("biblio.mdb")) = "BIBLIO.MDB" Then
  151.             Data1.DatabaseName = .filename
  152.             End If
  153.             Resume
  154.           Else
  155.             Unload Me
  156.           End If
  157.         End With
  158.     ElseIf Err <> 0 Then ' 
  159.         MsgBox "
  160. " & Err.Description
  161.         End
  162.     End If
  163.     Resume FormLoad_Exit
  164. End Sub
  165. Sub DoInitialSettings()
  166.     Dim i%
  167.     flex.Row = 0
  168.     flex.ColAlignment(0) = 7
  169.     For i = 0 To flex.Cols - 1
  170.         flex.Col = i
  171.         flex.CellFontSize = 14
  172.         flex.CellAlignment = 4
  173.         
  174.         flex.MergeCol(i) = True     ' 
  175.         flex.ColWidth(i) = 2000     ' 
  176.     Next i
  177.     flex.MergeCells = flexMergeRestrictColumns
  178. End Sub
  179. Sub DoSql()
  180.     Dim mysql$
  181.     mysql$ = "SELECT "
  182.     mysql = mysql & "Publishers.[Company Name], "
  183.     mysql = mysql & "Authors.Author, "
  184.     mysql = mysql & "Titles.Title "
  185.     mysql = mysql & "FROM Authors INNER JOIN "
  186.     mysql = mysql & "(Publishers INNER JOIN ([title author] INNER JOIN Titles ON [title author].ISBN = Titles.ISBN) ON Publishers.PubID = Titles.PubID) "
  187.     mysql = mysql & "ON Authors.Au_ID = [title author].Au_ID "
  188.     Data1.RecordSource = mysql
  189. End Sub
  190. Sub DoSort()
  191.     flex.Col = 0
  192.     flex.ColSel = flex.Cols - 1
  193.     flex.Sort = 1 ' 
  194. End Sub
  195.