Questo sito utilizza cookies solo per scopi di autenticazione sul sito e nient'altro. Nessuna informazione personale viene tracciata. Leggi l'informativa sui cookies.
Username: Password: oppure
C# / VB.NET - Rinominare i file con dati in tabella excel..
Forum - C# / VB.NET - Rinominare i file con dati in tabella excel.. - Pagina 3

Pagine: [ 1 2 3 ] Precedente | Prossimo
Avatar
sps84 (Normal User)
Expert


Messaggi: 202
Iscritto: 11/02/2009

Segnala al moderatore
Postato alle 23:41
Venerdė, 27/02/2009
adesso funziona tutto il programma...
Codice sorgente - presumibilmente VB.NET

  1. Imports System
  2. Imports System.IO
  3. Public Class Form1
  4.  
  5.     Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6.  
  7.         'leggo il file lista.txt
  8.  
  9.         Try
  10.  
  11.             Using sr As StreamReader = New StreamReader(Application.StartupPath & "\lista.txt")
  12.  
  13.                 Dim line As String
  14.  
  15.                 'creo l evento che mi legge le righe
  16.  
  17.                 Do
  18.  
  19.                     line = sr.ReadLine()
  20.  
  21.                     ' facio terminare il prg alla fine
  22.  
  23.                     If line = "" Then
  24.  
  25.                         Exit Do
  26.  
  27.                     End If
  28.  
  29.                     'MsgBox("Riga: " & line)
  30.  
  31.                     'creo le due stringhe
  32.  
  33.                     Dim linea As String
  34.  
  35.                     linea = line
  36.  
  37.                     'divido la stringa
  38.  
  39.                     Dim parti() As String = linea.Split(";")
  40.  
  41.                     'controllo se esiste la foto
  42.  
  43.                     If My.Computer.FileSystem.FileExists(parti(0) & ".jpg") Then
  44.  
  45.  
  46.                         'MsgBox("Il file esiste")
  47.  
  48.                         My.Computer.FileSystem.RenameFile(parti(0) & ".jpg", parti(1) & ".jpg")
  49.  
  50.                     Else
  51.  
  52.                         'MsgBox("Manca il file: " & parti(1) & ".jpg")
  53.  
  54.                     End If
  55.  
  56.                     'MsgBox(parti(0))
  57.  
  58.                 Loop
  59.  
  60.                 MsgBox("Fine Programma")
  61.  
  62.             End Using
  63.  
  64.         Catch ex As Exception
  65.  
  66.         End Try
  67.  
  68.     End Sub
  69.  
  70.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  71.  
  72.     End Sub
  73.  
  74. End Class



;);)

PM Quote
Avatar
Il Totem (Admin)
Guru^2


Messaggi: 3635
Iscritto: 24/01/2006

Segnala al moderatore
Postato alle 16:31
Sabato, 28/02/2009
Ok :k:

PM Quote
Pagine: [ 1 2 3 ] Precedente | Prossimo