Help with ListBox editing - [2002 / 2003]
Hey first time poster so be gentle >_<
Writing an app that needs to read a value off a list box then update that value dynamically.
so i figured write an add / subtract function for the first step
Function increase(ByVal i As Integer, ByVal j As Integer) As Integer
increase = i + j
End Function
Function decrease(ByVal i As Integer, ByVal j As Integer) As Integer
decrease = i - j
Function
Then I get owned by being a novice when it comes to listboxes and arrays -- only being doing this for a couple of days now :(
I tried
Private Sub RemBal_Click(ByVal sender As System.Object, ByVal e As _ System.EventArgs) Handles RemBal.Click
increase(CInt(Balance.SelectedIndex), CInt(TextBox1.Text))
End Sub
It Aims to read the value from highlighted part (the selected value)of a listBox called Balance then increase the value using the function above by a value that is put in a text box called TextBox1.
Really just need help with selecting the value in a listbox and editing it
Didn't really do much and was wondering if anyone could point me in the right direction. Thanks a bunch in advance
Re: Help with ListBox editing - [2002 / 2003]
Currymunch14, i am not sure what you want to do can you explain me better ? if you dont want, no problem.
Re: Help with ListBox editing - [2002 / 2003]
What does the SelectedIndex property of a ListBox represent? It represents the index of the item that is selected in the LstBox. Is that what you want? If the user selects the fifth item in the ListBox SelectedIndex will return 4, because indexes are zero-based. Now, if that item is the number 20, obviously you want 20, not 4. You get the item that is selected using the aptly-named SelectedItem property.
Re: Help with ListBox editing - [2002 / 2003]
I knew he had to use the Selected item property but i wasnt shure