Jump to content

Mid()


netbrfakes
 Share

Go to solution Solved by ribeiro55,

Recommended Posts

Boa noite, preciso de uma ajuda nesse codigo

If Not T_separar.Text Is Nothing Then
               Dim toremovelist As New List(Of String)
               For Each item As String In ListBox1.Items

                   If item.Contains(T_separar.Text) Then
                       toremovelist.Add(item)
                       ListBox2.Items.Add(item)
                   End If

               Next
               For Each removeitem In toremovelist

ele funciona porem ele busca na linha toda, eu preciso , que ele faca a busca apenas no 1 numero da linha

porem salve a linha toda , ex

42362387358

42342342342

58963893900

46378687990

68993988298

79836792737

Caso eu coloque no textbox, o numero 4 ele pegue apenas os que tem o numero 4 no inicio , e salve a linha toda

e assim por diante!

Link to comment
Share on other sites

Bom dia

Penso que tenhas que fazer:

Listbox.items.remove <> 4

Estilo remover tudo o que é diferente de 4

Como estou no telemóvel não consigo testar

Mas procura no Google "vb.net listbox área remove numbers except one"

Para ser o primeiro número tens que usar o index(0) da linha

(0) primeiro

(1) segundo

Etcetc

Tens um erro em cima pois estou a teclar no tlm "area"=array

Nuno Revez

@informaster

Link to comment
Share on other sites

  • Solution

Então... faz o teste lógico só no primeiro caractere:

For Each Itm As String In ListBox1.Items
   If Itm(0) = T_separar.Text Then
       Stop 'faz o que tens a fazer
   End If
Next

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

Se não funciona contigo é porque alguma coisa estás a fazer mal.

http://download.sergioribeiro.com/misc/pq.JPG

E se não partilhares a razão, não conseguimos ajudar 🙂

Sérgio Ribeiro


"Great coders aren't born. They're compiled and released"
"Expert coders do not need a keyboard. They just throw magnets at the RAM chips"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.