Jump to content

For each de elementos de Listbox


Go to solution Solved by Andrepereira9,

Recommended Posts

Posted

ola...sou novo aqui e este é o meu primeiro post... espero que esteja tudo bem convosco....

passa-se o seguinte...tenho este pequeno codigo mas não consigo por o "move" para cada elemento da Listbox.....

 

ajuda por favor??

 

   Private Sub btninstall_Click(sender As Object, e As EventArgs) Handles btninstall.Click
       Dim sourceDir = inputfdl.SelectedItems
       Dim inn = input.Text & "\" & inputfdl.SelectedItem
       Dim out = bank1.Text & "\" & inputfdl.Text
       For Each file As String In sourceDir

           My.Computer.FileSystem.MoveFile(inn, out)
       Next file
       Call install()

   End Sub

Obrigado!!

  • Solution
Posted

Boas

Pelo que percebi, tens uma Listbox preenchida com nomes dos ficheiros, e queres mover todos os ficheiros que estão na Listbox de uma pasta para outra.
Se assim for, experimenta assim:

 

 Dim sourceDir = inputfdl.Items

 For Each file As String In sourceDir
     Dim inn = input.Text & "\" & file.ToString

     Dim out = bank1.Text & "\" & file.ToString


     My.Computer.FileSystem.MoveFile(inn, out)
 Next file

 

A informática chegou para resolver problemas que antes não existiam

Quem ri por último é porque está conectado a 52 Kbs.

Posted

Ola pessoal...desculpem mas estou outra vez encalacrado com of for each..

agora passa-se isto:

  Dim item = list1.SelectedItems
  For Each fil As String In item
      Dim wavFile As String = FolderB2.SelectedPath & "\" & list1.SelectedItem & ".wav"
      Dim mp3File As String = textfold.Text & "\" & list1.SelectedItem & ".mp3"
      ConvertWavToMp3(wavFile, mp3File)
  Next

Obrigado por qualquer suporte 🙂

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
×
×
  • 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.