home *** CD-ROM | disk | FTP | other *** search
- VERSION 4.00
- Begin VB.Form frmMulti
- Caption = "Multiple-Column List Box"
- ClientHeight = 4800
- ClientLeft = 240
- ClientTop = 1575
- ClientWidth = 8310
- BeginProperty Font
- name = "MS Sans Serif"
- charset = 1
- weight = 700
- size = 8.25
- underline = 0 'False
- italic = 0 'False
- strikethrough = 0 'False
- EndProperty
- Height = 5205
- Left = 180
- LinkTopic = "Form2"
- ScaleHeight = 4800
- ScaleWidth = 8310
- Top = 1230
- Width = 8430
- Begin VB.CommandButton cmdClear
- Caption = "C&lear"
- Height = 495
- Left = 6480
- TabIndex = 4
- Top = 1440
- Width = 1215
- End
- Begin VB.CommandButton cmdClose
- Caption = "&Close"
- Height = 495
- Left = 6480
- TabIndex = 3
- Top = 2760
- Width = 1215
- End
- Begin VB.CommandButton cmdTransfer
- Caption = "&Transfer"
- Default = -1 'True
- Height = 495
- Left = 6480
- TabIndex = 2
- Top = 600
- Width = 1215
- End
- Begin VB.ListBox lstBottom
- Height = 1590
- Left = 600
- TabIndex = 1
- Top = 2400
- Width = 5295
- End
- Begin VB.ListBox lstTop
- Columns = 2
- Height = 1590
- Left = 600
- MultiSelect = 2 'Extended
- Sorted = -1 'True
- TabIndex = 0
- Top = 480
- Width = 5295
- End
- Attribute VB_Name = "frmMulti"
- Attribute VB_Creatable = False
- Attribute VB_Exposed = False
- Private Sub cmdClear_Click()
- lstBottom.Clear
- cmdClear.Enabled = False ' The bottom list is now empty, so disable the Clear button.
- End Sub
- Private Sub cmdClose_Click()
- Unload Me ' Unload this form.
- End Sub
- Private Sub cmdTransfer_Click()
- For n = 0 To (lstTop.ListCount - 1)
- If lstTop.Selected(n) = True Then ' If selected, then, add to the bottom list.
- lstBottom.AddItem lstTop.List(n)
- End If
- Next
- cmdClear.Enabled = True ' An item is now in the bottom list, so enable the Clear button.
- End Sub
- Private Sub Form_Load()
- ' Note that the 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
- End Sub
- Private Sub lstTop_DblClick()
- cmdTransfer.Value = True ' A user clicked the Transfer button.
- End Sub
-