I'm working on a mass text replacer program because I'm sick of all the 10-day trial ones out there that aren't very good.
The entire program is basically finished (All easy stuff), but now I need to code the actual replace/delete stuff, which I'm stuck on because apparently the way I originally intended to do it is not possible.
The way it works is you load a text file (.txt, .cfg, .ini, .doc, etc.) which opens a StreamReader which writes all the data into a listbox. Then you pick whether you want to replace or delete a string. If you select replace, then you enter the string to search for and in another textbox you enter the string to replace it with.
The way I originally intended to do this was like this:
If o1.Text = "Replace" Then 'The option Replace(txtfile, str1, a1) 'txtfile is the data, str1 is the string to find and a1 is the replacement End If
The problem is, I believe this method requires txtfile, str1 and a1 to be strings, but they're all 1-dimensional string arrays, which cannot be converted to strings, or at least I don't know how to convert them.
A friend told me one way I could do this is to open both a StreamReader and StreamWriter and do the replace/delete line by line as they are entered into the memory and write them to a temporary file which is then copied over the original. I can do this kind of, but I still don't know the proper way of doing the actual replace code because the string to find and the string to replace with are still 1-dimensional string arrays rather than strings.
I can't think of any other way to do this, due to I'm not that experienced in VBNet. Any help is greatly appreciated.
Edited 7 Years Ago by Darkicon: n/a