home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / dataex / gridsamp.frm (.txt) < prev   
Encoding:
Visual Basic Form  |  1995-05-07  |  3.9 KB  |  135 lines

  1. VERSION 2.00
  2. Begin Form Form2 
  3.    Caption         =   "Grid Example"
  4.    ClientHeight    =   3375
  5.    ClientLeft      =   900
  6.    ClientTop       =   2550
  7.    ClientWidth     =   8475
  8.    Height          =   3780
  9.    Left            =   840
  10.    LinkTopic       =   "Form2"
  11.    ScaleHeight     =   3375
  12.    ScaleWidth      =   8475
  13.    Top             =   2205
  14.    Width           =   8595
  15.    Begin SpinButton Spin2 
  16.       Height          =   615
  17.       Left            =   6840
  18.       Top             =   480
  19.       Width           =   735
  20.    End
  21.    Begin SpinButton Spin1 
  22.       Height          =   615
  23.       Left            =   4800
  24.       Top             =   480
  25.       Width           =   735
  26.    End
  27.    Begin CommandButton cmdReturn 
  28.       Caption         =   "Return"
  29.       Height          =   495
  30.       Left            =   4800
  31.       TabIndex        =   1
  32.       Top             =   1680
  33.       Width           =   1815
  34.    End
  35.    Begin Grid Grid1 
  36.       Cols            =   3
  37.       Height          =   735
  38.       Left            =   600
  39.       Rows            =   3
  40.       ScrollBars      =   0  'None
  41.       TabIndex        =   0
  42.       Top             =   360
  43.       Width           =   3495
  44.    End
  45.    Begin Label Label2 
  46.       Caption         =   "Next/Prior Frame"
  47.       Height          =   255
  48.       Left            =   6840
  49.       TabIndex        =   3
  50.       Top             =   120
  51.       Width           =   1455
  52.    End
  53.    Begin Label Label1 
  54.       Caption         =   "Next/Prior Record"
  55.       Height          =   255
  56.       Left            =   4800
  57.       TabIndex        =   2
  58.       Top             =   120
  59.       Width           =   1695
  60.    End
  61. Option Explicit
  62. Sub cmdReturn_Click ()
  63.     Unload form2
  64.     form1.Data1.Recordset.MoveFirst
  65.     form1.Show
  66. End Sub
  67. Sub spin1_spindown ()
  68.     Dim i As Integer
  69.     On Error Resume Next
  70.     'First, try and move next. If we're currently on the last record
  71.     'EOF will be detected, so the code really can't advance next.
  72.     'So, just restore the position to the last record, beep, and
  73.     'get out of here.
  74.     form1.Data1.Recordset.MoveNext
  75.     If form1.Data1.Recordset.EOF Then
  76.         Beep
  77.         form1.Data1.Recordset.MoveLast
  78.         Exit Sub
  79.     End If
  80.         
  81.     'Otherwise, back up, but not off the beginning of the database.
  82.     For i = 1 To FRAME_SIZE - 1
  83.         form1.Data1.Recordset.MovePrevious
  84.         If form1.Data1.Recordset.BOF Then
  85.             form1.Data1.Recordset.MoveFirst
  86.             Exit For
  87.         End If
  88.     Next i
  89.     'Now that we're positioned on the correct record, display the frame.
  90.     LoadFrame
  91. End Sub
  92. Sub Spin1_SpinUp ()
  93.     Dim i As Integer
  94.     On Error Resume Next
  95.     For i = 1 To FRAME_SIZE
  96.         form1.Data1.Recordset.MovePrevious
  97.         If form1.Data1.Recordset.BOF Then
  98.             Beep
  99.             form1.Data1.Recordset.MoveFirst
  100.             Exit For
  101.         End If
  102.     Next i
  103.     LoadFrame
  104. End Sub
  105. Sub Spin2_SpinDown ()
  106.     Dim i As Integer
  107.     On Error Resume Next
  108.     'First, try and move next. If we're currently on the last record
  109.     'EOF will be detected, so the code really can't advance next.
  110.     'So, just restore the position to the last record, beep, and
  111.     'get out of here.
  112.     form1.Data1.Recordset.MoveNext
  113.     If form1.Data1.Recordset.EOF Then
  114.         Beep
  115.         form1.Data1.Recordset.MoveLast
  116.         Exit Sub
  117.     End If
  118.         
  119.     'Now that we're positioned on the correct record, display the frame.
  120.     LoadFrame
  121. End Sub
  122. Sub Spin2_SpinUp ()
  123.     Dim i As Integer
  124.     On Error Resume Next
  125.     For i = 1 To FRAME_SIZE * 2 - 1
  126.         form1.Data1.Recordset.MovePrevious
  127.         If form1.Data1.Recordset.BOF Then
  128.             Beep
  129.             form1.Data1.Recordset.MoveFirst
  130.             Exit For
  131.         End If
  132.     Next i
  133.     LoadFrame
  134. End Sub
  135.