|
-
Oct 8th, 2007, 12:46 AM
#1
Thread Starter
New Member
editing a .cfg file or text file
Hello,
i need to know what code to use for editing certain parts of a .cfg or .txt file.
I want it to find a certain string and replace it.
Thankyou
-
Oct 8th, 2007, 04:37 PM
#2
Re: editing a .cfg file or text file
do a search in the forum, or look in the codebank
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Oct 9th, 2007, 08:18 AM
#3
Re: editing a .cfg file or text file
Read the file into a textbox, make your changes, and save it back out overlaying the original.
-
Oct 9th, 2007, 06:39 PM
#4
Lively Member
Re: editing a .cfg file or text file
Here Is Something That I Made Hope Its Usefull
Code:
Private Sub btnLoad_Click()
FF = FreeFile
Open "C:\Test.txt" For Input As #FF ' Or You Can Try "C:\Test.cfg" Or Choose Other Path
Input #FF, TextOfFile
txtFile.Text = TextOfFile
Close #FF
End Sub
Private Sub btnSave_Click()
FF = FreeFile
Open "C:\Test.txt" For Output As #FF ' Or You Can Try "C:\Test.cfg" Or Choose Other Path
Print #FF, txtFile.Text
Close #FF
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|