By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,963 Members | 2,122 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,963 IT Pros & Developers. It's quick & easy.

how to validate textbox from accepting duplicates and combo box from displaying dupli

P: 1
I have a text box which will be use accept the input,
combo box for displaying the output.
Now, i some codes that will be use to prevent me from entering
repeated numbers into the text box and also i need some codes to prevent the combo box from displaying the output.thanks
Apr 26 '14 #1
Share this Question
Share on Google+
1 Reply

P: 299
Instead of asking what you've tried for such a simple request, I'm just going to provide you with something. You can modify it to your liking. I used a textbox, a button, and a combobox. I put this code on my button. I suggest you test it on a new project first.

Expand|Select|Wrap|Line Numbers
  1.         Dim uniqueItem As String = TextBox1.Text
  2.         Dim uniqueItemsExists As Boolean = False
  4.         For Each itm In ComboBox1.Items
  5.             If itm = uniqueItem Then
  6.                 uniqueItemsExists = True
  7.             End If
  8.         Next
  10.         If uniqueItemsExists = False Then
  11.             ComboBox1.Items.Add(uniqueItem)
  12.         End If
Apr 26 '14 #2

Post your reply

Sign in to post your reply or Sign up for a free account.