汗,這個也要叫高手,現在的人,越來越不想自己動手了.哎!
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim x As Integer = Me.ListBox1.Items.Count
Dim strTemp, strTemp01, strTemp02, strTemp03, strtemp04 As String
Dim flag As Boolean = False
strTemp01 = Me.TextBox1.Text
strTemp02 = Me.TextBox2.Text
strTemp03 = Me.TextBox3.Text
strtemp04 = Me.TextBox4.Text
If x = 0 Then
Me.ListBox1.Items.Add(strTemp01)
Me.ListBox1.Items.Add(strTemp02)
Me.ListBox1.Items.Add(strTemp03)
Me.ListBox1.Items.Add(strtemp04)
Else
For i As Integer = 0 To x - 1
strTemp = Me.ListBox1.Items(i).ToString
If strTemp01 = strTemp Or strTemp02 = strTemp Or strTemp03 = strTemp Or strtemp04 = strTemp Then
flag = True
End If
Next
If flag = False Then
Me.ListBox1.Items.Add(strTemp01)
Me.ListBox1.Items.Add(strTemp02)
Me.ListBox1.Items.Add(strTemp03)
Me.ListBox1.Items.Add(strtemp04)
End If
End If
End Sub