Soyez le premier à donner votre avis sur cette source.
Vue 18 921 fois - Téléchargée 589 fois
Imports System Imports System.IO Public Class Form1 Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lbl_title.Click End Sub Private Sub bt_browse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_browse.Click ParcoursRep.ShowDialog() inputFichier.Text = ParcoursRep.FileName End Sub Private Sub ParcoursRep_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles ParcoursRep.FileOk End Sub Private Sub bt_go_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt_go.Click If inputFichier.Text = "" Then MsgBox("Veuillez choisir un fichier !") Else Dim nomFichier As String Dim nvoFichier As String Dim lng As Integer Dim count As Integer count = 0 nomFichier = inputFichier.Text lng = nomFichier.Length nvoFichier = nomFichier.Substring(0, lng - 4) nvoFichier = nvoFichier & "_2.txt" Using sw As StreamWriter = File.CreateText(nvoFichier) Try Using sr As StreamReader = New StreamReader(inputFichier.Text) Dim line As String ' Read and display the lines from the file until the end ' of the file is reached. Do line = sr.ReadLine() If line <> "" Then sw.WriteLine(line) count += 1 End If Loop Until line Is Nothing sr.Close() End Using Catch ex1 As Exception ' Let the user know what went wrong. MsgBox("Le fichier ne peut pas être lu :" & ex1.Message) End Try sw.Close() lblResult.Text = "Taritement terminé : " & count & " lignes écrites." End Using End If End Sub End Class
16 oct. 2007 à 10:49
16 oct. 2007 à 08:33
16 oct. 2007 à 02:24
Bonne prog a tous
15 oct. 2007 à 18:53
15 oct. 2007 à 17:29
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.