here's what I came up with while waiting to see if someone else could knock something out:
vb.net Code:
Imports System.IO Public Class Form1 Dim srcFilename As String = "" Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub replaceButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles replaceButton.Click Dim path As String = "MyFilePath" Dim dDir As New DirectoryInfo(path) Dim fFileSystemInfo As FileSystemInfo For Each fFileSystemInfo In dDir.GetFileSystemInfos() Dim fs As New FileStream(fFileSystemInfo.FullName, FileMode.Open, FileAccess.ReadWrite) Dim ioFile As New StreamReader(fs) Dim myText As String = ioFile.ReadLine() If myText = "stringImsearchingfor" myText.Replace(myText, "replacementtext") filesListbox.Items.Add(fFileSystemInfo.Name) Else Me.notEditedTextbox.Text &= Environment.NewLine & fFileSystemInfo.Name End If ioFile.Close() 'Close file Next End Sub End Class
the condition is being met correctly and the files (edited and nonedited) get added to the correct control (listbox if edited, textbox if not edited) but the files themselves are not being updated. am i missing something?






Reply With Quote