假定文字框在Form1,列表框在Form2,則以下程式碼放在Form2:Private Sub List1_Click()Dim s As String, i As IntegerFor i = 0 To List1.ListCount - 1 If List1.Selected(i) Then If s <> "" Then s = s & "," s = s & List1.List(i) End IfNextobj.Text = sEnd Sub以下程式碼放在Form1:Private Sub Command1_Click() "第一個文字框後面的+按鈕Set Obj = Text1Form2.ShowEnd SubPrivate Sub Command2_Click() "第二個文字框後面的+按鈕Set Obj = Text2Form2.ShowEnd Sub以下程式碼放在公共模組(Module)檔案:Public obj As Object
假定文字框在Form1,列表框在Form2,則以下程式碼放在Form2:Private Sub List1_Click()Dim s As String, i As IntegerFor i = 0 To List1.ListCount - 1 If List1.Selected(i) Then If s <> "" Then s = s & "," s = s & List1.List(i) End IfNextobj.Text = sEnd Sub以下程式碼放在Form1:Private Sub Command1_Click() "第一個文字框後面的+按鈕Set Obj = Text1Form2.ShowEnd SubPrivate Sub Command2_Click() "第二個文字框後面的+按鈕Set Obj = Text2Form2.ShowEnd Sub以下程式碼放在公共模組(Module)檔案:Public obj As Object