i have come accross another problem....
im trying to replace data from listbox1.selecteditem to listbox2.selecteditem
i have a temp.txt text file that loads in to listbox1 (rlines) this is the methord i use to load each file in to a list box...
Try Dim file_name As String = tempdata() Dim stream_reader As New IO.StreamReader(file_name) Dim line As String line = stream_reader.ReadLine() Do While Not (line Is Nothing) ' make sure the line aint blank. line = line.Trim() If line.Length > 0 Then rlines.Items.Add(line) line = stream_reader.ReadLine() Loop filen.SelectedIndex = 0 stream_reader.Close() Catch exc As Exception ' if errors. MsgBox(exc.Message, MsgBoxStyle.Exclamation, "Read Error") End Try
now if i code in to the listbox2 load button (button that loads a text file in to listbox2)
If line.Contains("my line of text") Then line = Replace(line, "my line of text", rlines.SelectedItem) End If
it dose what it says and replaces that line of text from the data loading in to listbox2 with the data i selected in listboz1(rlines) but what im looking for is to have the data load in to listbox2 and then have a button so i can select a line in listbox1 and in listbox 2 and it will replace the line from listbox1 in to listbox2 now i can add a line in to listbox2 from listbox1 with
but cant find a replace for it
if anyone knows how i can do this it would be excellent thanks for looking