home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / nodefnd / nodes.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  2.8 KB  |  97 lines

  1. VERSION 2.00
  2. Begin Form Nodes 
  3.    BackColor       =   &H00FFFF00&
  4.    Caption         =   "Node Finder"
  5.    ClientHeight    =   4035
  6.    ClientLeft      =   8445
  7.    ClientTop       =   4560
  8.    ClientWidth     =   3030
  9.    Height          =   4440
  10.    Left            =   8385
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4035
  13.    ScaleWidth      =   3030
  14.    Top             =   4215
  15.    Width           =   3150
  16.    Begin TextBox Text1 
  17.       Height          =   285
  18.       Left            =   1020
  19.       MaxLength       =   3
  20.       TabIndex        =   1
  21.       Top             =   60
  22.       Width           =   795
  23.    End
  24.    Begin Grid Grid1 
  25.       FixedCols       =   0
  26.       Height          =   3630
  27.       Left            =   30
  28.       Rows            =   15
  29.       ScrollBars      =   0  'None
  30.       TabIndex        =   0
  31.       Top             =   390
  32.       Width           =   2970
  33.    End
  34.    Begin Label Label1 
  35.       BackStyle       =   0  'Transparent
  36.       Caption         =   "Search :"
  37.       Height          =   225
  38.       Left            =   75
  39.       TabIndex        =   2
  40.       Top             =   90
  41.       Width           =   780
  42.    End
  43. 'Database vars
  44. Dim MyDBF As database
  45. Dim NodesTB As Table
  46. Sub Form_Load ()
  47. 'Open File
  48. Set MyDBF = OpenDatabase(App.path, False, False, "dBase III")
  49. Set NodesTB = MyDBF.OpenTable("nodefind")
  50. NodesTB.Index = "id"
  51. 'Set Grid properties
  52. Grid1.ColWidth(0) = 180 * 3
  53. Grid1.ColWidth(1) = 180 * 13.2
  54. Grd_Write Grid1, 0, 0, "Code"
  55. Grd_Write Grid1, 0, 1, "Location"
  56. 'Fill Grid and bookmark (MARK) array for the first time
  57. For i = Grid1.FixedRows To Grid1.Rows - Grid1.FixedRows
  58.     Grd_Write Grid1, i, 0, NodesTB(0)
  59.     Grd_Write Grid1, i, 1, NodesTB(1)
  60.     Mark(1, i) = NodesTB.Bookmark
  61.     NodesTB.MoveNext
  62. Grid1.Row = 1
  63. End Sub
  64. Sub Grid1_KeyDown (KeyCode As Integer, Shift As Integer)
  65.     'Call the browse sub
  66.     'Pay atention to the parameters
  67.     'Watch the Grid1_SelChange sub
  68.     Grid_Browse KeyCode, Shift, Grid1, NodesTB, 1
  69. End Sub
  70. Sub Grid1_SelChange ()
  71.     'Highlight an grid row
  72.     Grid1.SelStartCol = 0
  73.     Grid1.SelEndCol = 1
  74. End Sub
  75. Sub Text1_Change ()
  76. Dim CurRow As Integer
  77.     CurRow = Grid1.Row
  78.     NodesTB.Seek ">=", UCase(Left$(Text1.Text, 3))
  79.     If Not NodesTB.NoMatch Then
  80.         'Refresh grid and bookmark array data
  81.         For r = Grid1.FixedRows To Grid1.Rows - 1
  82.             For c = Grid1.FixedCols To Grid1.Cols - 1
  83.                 Grd_Write Grid1, r, c, NodesTB(c - Grid1.FixedCols)
  84.             Next
  85.             Mark(1, r) = NodesTB.Bookmark
  86.             NodesTB.MoveNext
  87.         Next
  88.         'Put the cursor on the first grid line
  89.         Grid1.Row = CurRow
  90.     End If
  91. End Sub
  92. Sub Text1_GotFocus ()
  93.     'Highlight entire text
  94.     Text1.SelStart = 0
  95.     Text1.SelLength = Len(Text1.Text)
  96. End Sub
  97.