Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ImageBam[^]

he problem occurs when I want to check if there is a number 1 and has a choice between numbers 1, 2, 10, 13, 16 etc. My algorithm sees more than 1, 1 from number 10, 1 from number 13 but I only want to see 1 just once. An improvement to the existing code would help me or some guidance as to how I could do this. I have doubled using (not to display the same number twice), but if the number corresponds to the word according to the code, then it will display and I do not want that.


it's just 2 numbers. I will only use numbers from 1 to 80 with space between them. example: 24 30 46 70 80. When I enter number 8, I do not want to display it as if it were 80, because it's about 80.

I received an answer but I do not know exactly how to apply.


What I have tried:

' Split string based on space
      Dim textsrtring As String = TextBox1.Text
      Dim words As String() = textsrtring.Split(New Char() {" "c})
      Dim found As Boolean = False
      ' Use For Each loop over words
      Dim word As String
      For Each word In words
          If TextBox2.Lines(0).Contains(word) Then
              found = True
              If CheckVar1.Text.Contains(word) Then
              Else
                  CheckVar1.Text = CheckVar1.Text + " " + TextBox1.Text()
              End If
          End If
Posted
Comments
Afzaal Ahmad Zeeshan 22-Oct-18 13:25pm    
This is unclear, you want to check whether a specific number exists in the data, or not. Is that so?

Also, if you want to check only once, then you can break out of the loop and the algorithm will not search for any more numbers.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900