Philippe Renaud
asked on
How to modify a value inside a 1 dimension listBox
Hello EE,
Lets say I have a Listbox that has been filled with a 1 dimensional array such as
1, 0
100,1
455,2
900,3
etc
how do I modify a single value inside it?
in other words see my code... I know its not good but lets say oldValue = 455 want to modify it so it will be replace by -1
any ideas?
Lets say I have a Listbox that has been filled with a 1 dimensional array such as
1, 0
100,1
455,2
900,3
etc
how do I modify a single value inside it?
in other words see my code... I know its not good but lets say oldValue = 455 want to modify it so it will be replace by -1
any ideas?
For x As Integer = 0 To ListBox4.Items.Count - 1
Dim myMatch As New MatchData
myMatch = ListBox4.Items(x)
If myMatch.Value = oldValue Then
ListBox4.Items(x)(0) = "Done"
End If
Next
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I understand what your line does, but, the problem is that if I have multiple same values.. it would find 2 rows
does it have like a FindStringExactAt lol? for index or something?
do you know what I mean
does it have like a FindStringExactAt lol? for index or something?
do you know what I mean
Your loop will do the same as well!
ASKER
lol right. sorry ;)
ASKER
mmm.. is it possible that it replace all the item at my index by new value ? Like if it was becoming a non dimensional line ?
becasue I am having an error saying unable to cast int32 type to [.....] MatchData
MatchData is a combinaison of 2 values (value and index)
i woudl like to keep the index but just modify the value.. not sure if Im doing this correctly with your last comment
or am i wrong ?
becasue I am having an error saying unable to cast int32 type to [.....] MatchData
MatchData is a combinaison of 2 values (value and index)
i woudl like to keep the index but just modify the value.. not sure if Im doing this correctly with your last comment
or am i wrong ?
My approach would not work with items of a custom type. Looping would work though.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks
ASKER
hey guys :)
if you didnt see it, I have another question here :
https://www.experts-exchange.com/questions/26968746/Linq-Where-clause.html
if you didnt see it, I have another question here :
https://www.experts-exchange.com/questions/26968746/Linq-Where-clause.html
ASKER