Deleting a string from a textfile
Hello,
the scenario is...
I have a listbox which is populated from a textfile. When the user double clicks an item in the listbox the value is put in a textbox to indicate that this is the value to delete from the list.
Does anyone have a snippit of code which looks for the value in the an array and delets it if found, then rewrites the array to the textfile?
Any help really appreciated.
I'd use the Replace() function
replace the string, then save the array to text file
Re: Deleting a string from a textfile
Quote:
Originally posted by HELPmyVB
Does anyone have a snippit of code which looks for the value in the an array and delets it if found, then rewrites the array to the textfile?
What array? The ListBox.List array?
If so:
VB Code:
List1.RemoveItem List1.Selected
(off the top of my head, I can't check right now, but that should be close)
Re: Deleting a string from a textfile
Quote:
Originally posted by HELPmyVB
Hello,
the scenario is...
I have a listbox which is populated from a textfile. When the user double clicks an item in the listbox the value is put in a textbox to indicate that this is the value to delete from the list.
Does anyone have a snippit of code which looks for the value in the an array and delets it if found, then rewrites the array to the textfile?
Any help really appreciated.
not sure i understand the question, but this will delete a searchstring from an array
VB Code:
arrOne = split(replace(join(arrTwo,vbcrlf),vbcrlf & strSearch & vbcrlf ,vbcrlf),vbcrlf)
untestested, but should give you the idea