how to compare array textboxes


Private Sub Text1_Change(Index As Integer)

   CheckForDupes Index
   
End Sub


Private Sub CheckForDupes(Index As Integer)

   'Nested loop
   Dim i As Integer, j As Integer
   
      For i = Text1.LBound To Text1.UBound
         For j = Text1.LBound To Text1.UBound
         
            'Eliminate comparison with the current textbox
            If Text1(i).Index <> Text1(j).Index Then
               
               'Check for a blank entry and if theres a duplicate
               If Text1(i).Text <> "" And Text1(j) <> "" And Text1(i) = Text1(j) Then
                  
                  'Inform user of duplicate entry and clear current textbox
                  MsgBox "Duplicate entry"
                  Text1(Index).Text = vbNullString
                  Exit For
               End If
            End If
         Next j
      Next i
      
End Sub

resource from
here

2 Comments to “how to compare array textboxes”

  1. Salam kenal…

    Silakan berkunjung… :)
    http://popnote.wordpress.com
    Terima kasih… :D

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: