Member 13055764 Ответов: 0

Vb net отметьте только слово в текстовом поле


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.


Что я уже пробовал:

' 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

Afzaal Ahmad Zeeshan

Это непонятно, вы хотите проверить, существует ли конкретное число в данных или нет. Так ли это?

Кроме того, если вы хотите проверить только один раз, то вы можете вырваться из цикла, и алгоритм не будет искать больше никаких чисел.

0 Ответов