D Lutheran wrote:
I need to write some code in some navigation buttons to have the button
move up and down list box items.
I think I need to start with having the button change an index
the buttons are previous, next and update. where previous would move
the cursor up the list one, next would move the cursor down the list
one and update would change the string that is in the current cursor
position in the list box
the data information is coming from three text boxes on a form.
ANy help would be appreciated.
Donna
Just in case anyone else is trying to figure out how to do this, here
is my code that works.
' A button that moves to a previous entry in the list box VB.net 2005
Private Sub btnPrev_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnPrev.Click
lstGrades.Text = CStr(lstGrades.Items(lstGrades.SelectedIndex -
1))
End Sub
' a button that moves to the next entry in a list box VB.net 2005
Private Sub btnNext_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnNext.Click
lstGrades.Text = CStr(lstGrades.Items(lstGrades.SelectedIndex +
1))
End Sub
I'm still trying to figure out this one ' button update a entry in the
list box.
Private Sub btnUpdate_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnUpdate.Click
End Sub
Keep in mind that the text might wrap from the posting and if you need
the above code, if it doesn't fit on one line, make sure you use a
space and an underscore.