home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form MultiGrd
- Caption = "Comments To: 71201,2304"
- ClientHeight = 5340
- ClientLeft = 1755
- ClientTop = 1635
- ClientWidth = 4140
- Height = 5745
- Left = 1695
- LinkTopic = "Form1"
- ScaleHeight = 5340
- ScaleWidth = 4140
- Top = 1290
- Width = 4260
- Begin ListBox List1
- ForeColor = &H00FF0000&
- Height = 1590
- Left = 375
- TabIndex = 4
- Top = 3060
- Width = 3285
- End
- Begin CommandButton ShowBtn
- Caption = "Show"
- Height = 400
- Left = 405
- TabIndex = 2
- Top = 4785
- Width = 1000
- End
- Begin CommandButton EndBtn
- Caption = "End"
- Height = 400
- Left = 2655
- TabIndex = 1
- Top = 4770
- Width = 1000
- End
- Begin Grid Grid1
- FixedCols = 0
- FixedRows = 0
- Height = 2004
- Left = 945
- Rows = 8
- TabIndex = 0
- Top = 105
- Width = 2310
- End
- Begin Label Label1
- Alignment = 2 'Center
- BorderStyle = 1 'Fixed Single
- Caption = "Label1"
- Height = 720
- Left = 75
- TabIndex = 3
- Top = 2190
- Width = 3945
- End
- DefInt A-Z
- ' This demo program illustrates how one can select
- ' non-adjascent rows of a grid for further processing.
- ' Running the program will populate the Grid with some data.
- ' You can then click on any column of EACH Row that you want
- ' to select. When a row is selected, a ">" symbol appears in
- ' the first column. To de-select a row, click on it again,
- ' and the ">" symbol disappears to indicate that the row is
- ' de-selected.
- ' After you have selected all the rows that you want,
- ' press the "SHOW" Button. The Items in Column 1 of the
- ' selected rows only will be added to the list box,
- ' as proof that the method works.
- ' Pressing the "END" Button ends the Program.
- ' Questions and Comments can be addressed to:
- Dim Shared Beers(0 To 7) As String
- Sub EndBtn_Click ()
- End
- End Sub
- Sub Form_Load ()
- CRLF$ = Chr$(13) + Chr$(10)
- Label1.Visible = False
- ' Sample Data for Grid
- Beers(0) = "Michelob"
- Beers(1) = "Budweiser"
- Beers(2) = "Bush"
- Beers(3) = "Corona Extra"
- Beers(4) = "Heineken"
- Beers(5) = "Fosters"
- Beers(6) = "Miller"
- Beers(7) = "HomeBrew"
- ' Populate the grid
- grid1.Col = 1
- For r = 0 To 7
- grid1.Row = r
- grid1.Text = Beers(r)
- Next r
- ' Adjust grid for display
- grid1.ColWidth(0) = 250
- grid1.ColWidth(1) = 2000
- grid1.Width = 2310
- grid1.Height = 1950
-
- ' Display Instructions
- Label1.Caption = "Click on one or more rows to select" & CRLF$
- Label1.Caption = Label1.Caption & "Click again to de-select" & CRLF$
- Label1.Caption = Label1.Caption & "Press SHOW Button when done selecting"
- Label1.Visible = True
- End Sub
- Sub Grid1_Click ()
- grid1.Col = 0
- If grid1.Text = ">" Then
- grid1.Text = ""
- Else
- grid1.Text = ">"
- End If
- End Sub
- Sub ShowBtn_Click ()
- list1.Clear ' Clear the List from possible
- ' prior usage
- ' Add Array item to list box if corresponding
- ' row in grid was selected
- grid1.Col = 0
- For i = 0 To 7
- grid1.Row = i
- If grid1.Text = ">" Then list1.AddItem Beers(i)
- Next i
- ' If list is empty, display appropriate message
- If list1.ListCount = 0 Then
- list1.AddItem "No Rows of Grid Were Selected!!"
- End If
- End Sub
-