Sorry Cor,
I was a bit vague. Since I wrote this I found my old test code I wrote in
VB6. I ran it through the upgrade wizard and it produce the following code
(aimple form, listbox and two commend buttons) This should
explain/demonstrate what I am trying to do. I could implement this as it
stands, it works, but it needs reference to the VB6 Compatibility. However,
I would like to do it completely in .NET. Does this make sense?
_______________________________________________________________________
Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles Command1.Click
Dim lposition As Short
Dim lposition2 As Short
Dim My_string1 As String
Dim My_string2 As String
'gj - to shuffle position of selected item.
'find position
lposition = List3.SelectedIndex
'find if already top of list
If lposition = 0 Then Exit Sub
lposition2 = (List3.SelectedIndex) - 1
My_string1 = VB6.GetItemString(List3, lposition)
My_string2 = VB6.GetItemString(List3, lposition2)
'find if list if empty
If My_string1 = "" Then Exit Sub
VB6.SetItemString(List3, lposition2, My_string1)
VB6.SetItemString(List3, lposition, My_string2)
List3.SelectedIndex = (List3.SelectedIndex) - 1
End Sub
Private Sub Command2_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles Command2.Click
Dim lposition As Short
Dim lposition2 As Short
Dim My_string1 As String
Dim My_string2 As String
'gj - to shuffle position of selected item.
'find position
lposition = List3.SelectedIndex
'find if already end of list
If lposition = (List3.Items.Count - 1) Then Exit Sub
lposition2 = (List3.SelectedIndex) + 1
My_string1 = VB6.GetItemString(List3, lposition)
My_string2 = VB6.GetItemString(List3, lposition2)
'find if list if empty
If My_string1 = "" Then Exit Sub
VB6.SetItemString(List3, lposition2, My_string1)
VB6.SetItemString(List3, lposition, My_string2)
List3.SelectedIndex = (List3.SelectedIndex) + 1
End Sub
Private Sub Form1_Load(ByVal eventSender As System.Object, ByVal eventArgs
As System.EventArgs) Handles MyBase.Load
List3.Items.Add("Blue")
List3.Items.Add("Red")
List3.Items.Add("Green")
List3.Items.Add("Pink")
List3.Items.Add("Orange")
List3.Items.Add("Maroon")
End Sub
________________________________________________