Hi, I am getting error and do not really understand why.
I have listbox and buttons to move items up and down. In if condition I get error index out of range when first item is selected and when second last is selected I am unable to create condition for append/add instead of insert, same problem with if condition.
I must by doing something really wrong.
Thanks for help.
mirek
If Not((listbox1.SelectedIndex = (listbox1.Count-1)) OR (listbox1.SelectedIndex = -1)) Then
temp=listbox1.SelectedIndex
tempstr=listbox1.Item(temp)
listbox1.Removeat(temp)
listbox1.Insert(temp+1,tempstr)
Listbox1.SelectedIndex=temp+1
Else If
Sound("")
End If
I have listbox and buttons to move items up and down. In if condition I get error index out of range when first item is selected and when second last is selected I am unable to create condition for append/add instead of insert, same problem with if condition.
I must by doing something really wrong.
Thanks for help.
mirek
If Not((listbox1.SelectedIndex = (listbox1.Count-1)) OR (listbox1.SelectedIndex = -1)) Then
temp=listbox1.SelectedIndex
tempstr=listbox1.Item(temp)
listbox1.Removeat(temp)
listbox1.Insert(temp+1,tempstr)
Listbox1.SelectedIndex=temp+1
Else If
Sound("")
End If