Public Class UserControlmultilistBox Inherits System.Windows.Forms.userControl
#Region "Windows Form Designer Generated Code"
Public Sub new () mybase.new ()
'This call is required by the windows form designer. InitializationComponent ()
'Add anyinitization after the initializecomponent () CALL
End Sub
'UserControl overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose (ByVal disposing As Boolean) If disposing Then If Not (components Is Nothing) Then components.Dispose () End If End If MyBase.Dispose (disposing) End Sub
'Required by The Windows Form Designer Private Components as System.comPonentModel.icontainer
'NOTE: The following procedure is required by the Windows Form Designer' It can be modified using the Windows Form Designer 'Do not modify it using the code editor Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents Label2 As System.. .Windows.Forms.Label Friend WithEvents lstLeft As System.Windows.Forms.ListBox Friend WithEvents lstRight As System.Windows.Forms.ListBox Friend WithEvents btnRightOne As System.Windows.Forms.Button Friend WithEvents btnRightMul As System.Windows.Forms.Button Friend WithEvents btnLeftOne As System.Windows.Forms.Button Friend WithEvents btnLeftMul As System.Windows.Forms.Button
Lstleft 'me.lstleft.itemheight = 12 me.lstleft.location = new system.drawing.point (6, 31) me.lstleft.name = "lstleft" me.lstleft.size = new system.drawing.size (120, 136) Me.lstleft.sorted = true me.lstleft.tabindex = 2 '' lstright 'me.lstright.ItemHeight = 12 me.lstright.location = new system.drawing.point (182, 31) me.lstright.name = "lstRight" Me.lstRight.Size = New System.Drawing.Size (120, 136) Me.lstRight.Sorted = True Me.lstRight.TabIndex = 3 '' btnRightOne 'Me.btnRightOne.Location = New System.Drawing.Point (134, 47) me.btnrightone.name = "btnrightone" me.btnrightone.size = new system.drawing.size (40, 23) me.btnrightone.tabindex = 4 me.btnrightone.text = ">" 'btnrightmul 'Me.btnrightmul.location = new system.drawing.point (134, 77) me.btnrightmul.name = "btnrightmul" me. btnRightMul.Size = New System.Drawing.Size (40, 23) Me.btnRightMul.TabIndex = 5 Me.btnRightMul.Text = ">>" '' btnLeftOne 'Me.btnLeftOne.Location = New System.Drawing.Point (134 , 106) Me.Btnleftone.name = "btnleftone" me.btnleftone.size = new system.drawing.size (40, 23) me.btnleftone.tabindex = 6 me.btnleftone.text = "<'' btnleftmul 'me .btnleftmul.location =
New system.drawing.point (134, 135) me.btnleftmul.name = "btnleftmul" me.btnleftmul.size = new system.drawing.size (40, 23) me.btnleftmul.tabindex = 7 me.btnleftmul.text = "<<" '' UserControlmultilistBox 'me.controls.add (me.btnleftmul) Me.Controls.add (me.btnrightmul) me.controls.add (me.btnright "me. Controls.add (me.lstright) me.controls.add (me.lstleft) me.controls.add (me.label1) me.name = "UserControlmultilistBox" me.size = new System.drawing.size (306, 176) Me.ResumeLayout (false) End Sub
#End region
Public property labelleft () As string get return label1.text.tostring end set (Byval value as string) label1.text = value end vend @ t
Public property labelrighttext () AS STRING GET RETURN Label2.text.tostring End (Byval Value As String) Label2.Text = Value End Set Property
Public Readonly Property LeftListBoxItems () As ListBox.ObjectCollection Get Return Lstleft.Items End Get Property
Public Readonly Property RightListBoxItems () As ListBox.ObjectCollection Get Return Lstright.Items End Get Property
Public Property ListBoxSelectMode () As SelectionMode Get Return lstLeft.SelectionMode End Get Set (ByVal Value As SelectionMode) lstRight.SelectionMode = Value lstLeft.SelectionMode = Value End Set End PropertyPublic Sub RightMoveOne () Dim e As System.EventArgs btnRightOne_Click (btnRightOne, e ) End Sub
Public Sub Rightmovemul () Dim e as system.eventargs btnrightmul_click (btnrightmul, e) end sub
Public Sub LeftmoveOne () Dim e as system.eventargs btnleftone_click (btnleftone, e) end sub
Public Sub LEFTMOVEMUL () Dim e as system.Eventargs btnleftmul_click (btnleftmul, e) end sub
Public Event Itemmoved (Byval NLEFT AS INTEGER, BYVAL NRIGHT AS INTEGER, BYVAL NDIRECTION AS INTEGER)
Private Sub btnRightOne_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRightOne.Click If lstLeft.Items.Count> 0 And lstLeft.SelectedIndex <> -1 Then Dim selectItem As Object Dim selectItems As New Collection Try For each selectItem In lstLeft.SelectedItems lstRight.Items.Add (selectItem) selectItems.Add (selectItem) Next For each selectItem In selectItems lstLeft.Items.Remove (selectItem) Next Catch ex As Exception MsgBox (ex.Message) End Try
End if End Sub
Private Sub btnLeftOne_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLeftOne.Click If lstRight.Items.Count> 0 And lstRight.SelectedIndex <> -1 Then Dim selectItem As Object Dim selectItems As New Collection Try For each selectItem In lstRight.SelectedItems lstLeft.Items.Add (selectItem) selectItems.Add (selectItem) Next For each selectItem In selectItems lstRight.Items.Remove (selectItem) Next Catch ex As Exception MsgBox (ex.Message) End Try selectItems = Nothing End If End SubPrivate Sub btnRightMul_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRightMul.Click With lstLeft If .Items.Count> 0 Then Dim oItem As Object For Each oItem In .Items lstRight .Items.add (OITEM) Next .Items.clear () end if End with end sub
Private Sub btnLeftMul_Click (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLeftMul.Click With lstRight If .Items.Count> 0 Then Dim oItem As Object For Each oItem In .Items lstLeft.Items.Add (oItem) Next .Items.clear () end if endh end sublend class
interface design