Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > it.comp.lang.visual-basic > #19073

Re: Ricerca files in una cartella

X-Received by 10.129.168.7 with SMTP id f7mr527204ywh.164.1498115243816; Thu, 22 Jun 2017 00:07:23 -0700 (PDT)
X-Received by 10.157.46.21 with SMTP id q21mr29462otb.11.1498115243775; Thu, 22 Jun 2017 00:07:23 -0700 (PDT)
Path csiph.com!feeder.erje.net!2.us.feeder.erje.net!news.glorb.com!v31no22367qtb.0!news-out.google.com!s132ni1509itb.0!nntp.google.com!185no621334itv.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail
Newsgroups it.comp.lang.visual-basic
Date Thu, 22 Jun 2017 00:07:23 -0700 (PDT)
In-Reply-To <9cbe72b2-0327-4e9c-8426-690ee4b31f65@googlegroups.com>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=213.215.169.20; posting-account=yvxj_woAAABxrxq8XihQzP-tWUWpycQc
NNTP-Posting-Host 213.215.169.20
References <45cdeed6-8d63-4465-a79d-8cfa9e8343e0@googlegroups.com> <9cbe72b2-0327-4e9c-8426-690ee4b31f65@googlegroups.com>
User-Agent G2/1.0
MIME-Version 1.0
Message-ID <c882d1dd-0593-4ded-977a-9e52db5a8ba9@googlegroups.com> (permalink)
Subject Re: Ricerca files in una cartella
From Marco75 <marcoporzi75@gmail.com>
Injection-Date Thu, 22 Jun 2017 07:07:23 +0000
Content-Type text/plain; charset="UTF-8"
Content-Transfer-Encoding quoted-printable
Xref csiph.com it.comp.lang.visual-basic:19073

Show key headers only | View raw


Il giorno mercoledì 21 giugno 2017 17:09:41 UTC+2, Luca D ha scritto:
> I metodi che trovi a partire da 'My.xxx' sono spesso scorciatoie a funzioni più complete del framework .NET, e vale quasi sempre la pena fare riferimento direttamente a quelle; in questo caso le classi che trovi in 'System.IO' hanno quello che serve:
> 
> Dim di As New System.IO.DirectoryInfo("C:\MiaCartella\")
> If di.Exists Then
>     Dim fi() As System.IO.FileInfo = di.GetFiles("*Verde*.jpg")
>     If fi.Length > 0 Then
>         frmAlert.Show()
>     Else
> 
>     End If
> End If

Grazie ad entrambi, funziona sia il codice per cercare i files che quello per filtrare la listbox, spero di cavarmela con tutti i dettagli che andrò a sviluppare.

solo una cosa, il codice Dim fi() As System.IO.FileInfo = di.GetFiles("*Verde*.jpg")  filtra il Verde, ma se volessi filtrare sia Verde che Bianco escludendo Giallo e Blu come faccio?

Una cosa del genere?
Dim fi() As System.IO.FileInfo = di.GetFiles("*Verde*.jpg") or Dim fi() As System.IO.FileInfo = di.GetFiles("*Bianco*.jpg")

Marco

Back to it.comp.lang.visual-basic | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Ricerca files in una cartella Marco75 <marcoporzi75@gmail.com> - 2017-06-21 07:51 -0700
  Re: Ricerca files in una cartella Luca D <antaniserse@yahoo.it> - 2017-06-21 08:09 -0700
    Re: Ricerca files in una cartella Marco75 <marcoporzi75@gmail.com> - 2017-06-22 00:07 -0700
      Re: Ricerca files in una cartella Marco75 <marcoporzi75@gmail.com> - 2017-06-22 01:27 -0700
        Re: Ricerca files in una cartella Luca D <antaniserse@yahoo.it> - 2017-06-22 01:53 -0700
          Re: Ricerca files in una cartella Marco75 <marcoporzi75@gmail.com> - 2017-06-22 02:06 -0700
            Re: Ricerca files in una cartella Luca D <antaniserse@yahoo.it> - 2017-06-22 07:05 -0700
              Re: Ricerca files in una cartella Marco75 <marcoporzi75@gmail.com> - 2017-06-22 07:14 -0700
  Re:Ricerca files in una cartella Paperino <non_te@lo.dico.invalid> - 2017-06-21 18:12 +0200

csiph-web