VB

Time:11-07

The two list boxes, but push the button of the list box 1 content appears in the list box 2 (the content of the list box 1 or unchanged at this time) when the selected list box again in the list box 1 2, is the content of the existing pop-up msgbox



Front (I just don't know how to write) repeated ask bosses give advice or comments

CodePudding user response:

Where is the great god is?

CodePudding user response:

According to your statement, should need two events, a button, click add. Another click the list click events
 
Private Sub Command2_Click () 'added to them one by one on the right side
Dim As Long I
If Me. List1. ListIndex=1 Then the Exit Sub 'does not select out
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then the Exit Sub
Next I
List2. AddItem List1. Text 'not on the right side, and we have selected on the left side of the entry, added to the right side of the
End Sub
Private Sub List1_Click ()
Dim As Long I
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then "If the right exists the same content
MsgBox "pop-up" tip "
The Exit Sub
End the If
Next I
End Sub


CodePudding user response:

refer to the second floor csdn_gdde response:
according to your statement, should need two events, a button, click add. Another click the list click events
 
Private Sub Command2_Click () 'added to them one by one on the right side
Dim As Long I
If Me. List1. ListIndex=1 Then the Exit Sub 'does not select out
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then the Exit Sub
Next I
List2. AddItem List1. Text 'not on the right side, and we have selected on the left side of the entry, added to the right side of the
End Sub
Private Sub List1_Click ()
Dim As Long I
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then "If the right exists the same content
MsgBox "pop-up" tip "
The Exit Sub
End the If
Next I
End Sub

For I=0 to list2. Listcount - 1 is what mean

CodePudding user response:

reference 3 floor sheng xiao _ response:
Quote: refer to the second floor csdn_gdde response:
according to your statement, should need two events, a button, click add. Another click the list click events
 
Private Sub Command2_Click () 'added to them one by one on the right side
Dim As Long I
If Me. List1. ListIndex=1 Then the Exit Sub 'does not select out
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then the Exit Sub
Next I
List2. AddItem List1. Text 'not on the right side, and we have selected on the left side of the entry, added to the right side of the
End Sub
Private Sub List1_Click ()
Dim As Long I
For I=0 To List2. ListCount - 1
If List1. Text=List2. List (I) Then "If the right exists the same content
MsgBox "pop-up" tip "
The Exit Sub
End the If
Next I
End Sub

For I=0 to list2. What do you mean listcount - 1


Cycle, existing data on the right side