kazzx Posted December 15, 2009 at 03:40 PM Report Share #300496 Posted December 15, 2009 at 03:40 PM viva, não há nenhuma maneira de seleccionar um nome numa listview e envia-la para uma listbox mas só enviar a palavra seleccionada após ter contado 4 caracteres? exemplo: tenho "1 - Manel" e na listbox aparecer apenas "Manel" ? Link to comment Share on other sites More sharing options...
Gooden Posted December 15, 2009 at 04:12 PM Report Share #300504 Posted December 15, 2009 at 04:12 PM Dim str As String = "1 - Manel" MsgBox(str.Substring(4)) tipo isto? Link to comment Share on other sites More sharing options...
kazzx Posted December 15, 2009 at 04:19 PM Author Report Share #300507 Posted December 15, 2009 at 04:19 PM tipo, mas no meu caso é um valor seleccionado da listview, um qualquer valor que lá vai aparecer depois de uma pesquisa. Link to comment Share on other sites More sharing options...
ribeiro55 Posted December 15, 2009 at 08:31 PM Report Share #300578 Posted December 15, 2009 at 08:31 PM SPLIT Altera para: Dim Str As String = "99999 - Manel" MsgBox(Split(Str, " - ")(UBound(Split(Str, " - ")))) ' ou simplificando Dim TempStr() As String = Split(Str, " - ") MsgBox(TempStr(UBound(TempStr))) 'ou já agora... Dim TempStr() As String = Split(Str, " - ") MsgBox("ID: " & TempStr(0) & " NOME: " & TempStr(1)) O que estás a tentar fazer é má prática, e dou-te já duas formas de solucionar o teu problema: - ListView (a details) usa colunas, logo podes meter o id numa coluna e o nome noutra - ListViewItem tem uma propriedade Tag do tipo Object, onde podes guardar o que te apetecer, nomeadamente o ID. 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now