home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form frmMulti
- Caption = "Multi-column List Box"
- Height = 5220
- Left = 600
- LinkTopic = "Form2"
- ScaleHeight = 4815
- ScaleWidth = 8295
- Top = 1155
- Width = 8415
- Begin CommandButton cmdClear
- Caption = "C&lear"
- Height = 495
- Left = 6480
- TabIndex = 4
- Top = 1440
- Width = 1215
- End
- Begin CommandButton cmdClose
- Caption = "&Close"
- Height = 495
- Left = 6480
- TabIndex = 3
- Top = 2760
- Width = 1215
- End
- Begin CommandButton cmdTransfer
- Caption = "&Transfer"
- Default = -1 'True
- Height = 495
- Left = 6480
- TabIndex = 2
- Top = 600
- Width = 1215
- End
- Begin ListBox lstBottom
- Height = 1590
- Left = 600
- TabIndex = 1
- Top = 2400
- Width = 5295
- End
- Begin ListBox lstTop
- Columns = 2
- Height = 1590
- Left = 600
- MultiSelect = 2 'Extended
- TabIndex = 0
- Top = 480
- Width = 5295
- End
- Sub cmdClear_Click ()
- lstBottom.Clear
- cmdClear.Enabled = False ' Bottom list now empty, so disable Clear button.
- End Sub
- Sub cmdClose_Click ()
- Unload Me ' Unload this form.
- End Sub
- Sub cmdTransfer_Click ()
- For n = 0 To (lstTop.ListCount - 1)
- If lstTop.Selected(n) = True Then ' If selected, then
- lstBottom.AddItem lstTop.List(n) ' add to bottom list.
- End If
- Next
- cmdClear.Enabled = True ' Something now in bottom list, so enable Clear button.
- End Sub
- Sub Form_Load ()
- ' Note that Sorted property of lstTop is True, so adding
- ' items in alphabetical order is not actually necessary.
- lstTop.AddItem "Acme Pavers"
- lstTop.AddItem "Belding and Associates"
- lstTop.AddItem "Banyan II, Inc."
- lstTop.AddItem "Feldspar, Feldspar, and Feldspar"
- lstTop.AddItem "Gold Dusters Housecleaning"
- lstTop.AddItem "MS Brothers Bakery"
- lstTop.AddItem "Northwind Traders"
- lstTop.AddItem "Sandor Cinemas"
- lstTop.AddItem "Tastings Catering"
- lstTop.AddItem "Tang and Ng, CPAs"
- lstTop.Selected(0) = True ' Select a couple of items
- lstTop.Selected(1) = True ' as a suggestion.
- End Sub
- Sub lstTop_DblClick ()
- cmdTransfer.Value = True ' Press Transfer button.
- End Sub
-