I'm having a little trouble working out how to make array items display in textboxes upon clicking on an item name displayed in a listbox.
I've got my array here.
and with some difficulty a filter running which I've got to display all the items from my file one load and filter through whatever I want.Code:Private Sub readFile() Dim reader As IO.StreamReader = New IO.StreamReader("..\..\Stock.txt") Dim i = 0 Do While reader.EndOfStream = False stockArray(i) = (reader.ReadLine).Split( "|") i += 1 Loop End Sub
However due to my novice experience and probably more to the point lack of useful examples that I can find. I am unable to now make it so that once I click on an item in my listbox it will load the remaining 8 pieces of data associated from my array into text boxes so that it may be edited in the array and then saved upon a button click. Could anyone please give me a nudge in the right direction? So far I'm trying to do things under a sub "ListBox1_SelectedIndexChanged" which "Handles ListBox1.SelectedIndexChanged" which I think it what I want. But I'm having trouble with the code there after. Current attempts are letting my textbox equals something to do with the list box but I'm not sure what and not how to have this directly linked and updated in the array once alterations or additions to data is complete.Code:Private Sub applySearch(x As String) ListBox1.Items.Clear() If x = "" Then While stockArray(i) IsNot Nothing ListBox1.Items.Add(stockArray(i)(0).ToString) txtsearch.AutoCompleteCustomSource.Add(stockArray(i)(0).ToString) i += 1 End While Else While stockArray(i) IsNot Nothing If stockArray(i)(0).ToString.ToLower.Contains(x.ToLower) Or stockArray(i)(0).ToString.ToLower = x.ToLower Or stockArray(i)(3).ToString.ToLower = x.ToLower Then ListBox1.Items.Add(stockArray(i)(0).ToString) txtsearch.AutoCompleteCustomSource.Add(stockArray(i)(0).ToString) End If i += 1 End While End If End Sub
Thank You a bunch for anyone that can help and I'm sorry if I have been unclear at all.




Reply With Quote
