|
-
Mar 31st, 2003, 12:21 PM
#1
Thread Starter
Addicted Member
Manually Reordering Listview Items...
Well heres my deal...I'm gonna have a operation that takes each listview item from a listview and uses them in order based on their indexs....or the way they r showing in the listview....
now im at the point were i need some code to manually resort the items one by one.....i figure this can be done one of to ways...either drag and drop the selected item to a position lower on the control, btw the listview is set to view.details, ooorrrrr i could have the user select and item and then click one of two buttons on the form to either move the item up of down one spot....
thx in advance for all of your help, as so far this forum has been very very helpful...
AcE
-
Mar 31st, 2003, 04:09 PM
#2
Thread Starter
Addicted Member
also could some1 put this in vb.net for me....somethings wrong with it...
Code:
Private Sub SaveList()
Dim sTemp As String
Dim sTemp1 As String
' Get the name the list is supposed to be saved as.
sTemp = "C:\Myfile.txt"
' Loop through and save all items in list.
If (lv_idlist.Items.Count > 0) Then
Try
' Create a StreamWriter object to write to the file.
Dim writer As New IO.StreamWriter(sTemp, False)
' Write the information to the file one line at a time.
sTemp1 = LV_IDList.Items.ToString
writer.WriteLine(sTemp1)
' Close the StreamWriter object.
writer.Close()
Catch
End Try
End If
and this other one has me puzzled.....i had it right the other day but now i cant figure it out....i sooo wish i would have saved it...
Code:
Private Sub B_RemoveSelected_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B_RemoveSelected.Click
lv_idlist.items(lv_idlist.selecteditems).remove
End Sub
its got to convert selecteditems to seperate items then do the remove....i no how all this crap works, i just dont no how to put it into vb code.....thx in advance...
AcE
-
Mar 31st, 2003, 08:12 PM
#3
Thread Starter
Addicted Member
ok...i figured out the saving of the listview....fixin to start working on loading it back into the listview...heres my save code...
Code:
Private Sub SaveList()
Dim sTemp As String
Dim sTemp1 As String
' Get the name the list is supposed to be saved as.
sTemp = "C:\Myfile.txt"
' Loop through and save all items in list.
If (LV_IDList.Items.Count > 0) Then
Try
Dim i As Integer
' Create a StreamWriter object to write to the file.
Dim writer As New IO.StreamWriter(sTemp, False)
' Write the information to the file one line at a time.
i = 0
Do
If i < LV_IDList.Items.Count Then
sTemp1 = LV_IDList.Items(i).Text & " , " & LV_IDList.Items(i).SubItems(1).Text
writer.WriteLine(sTemp1)
i = i + 1
Else
Exit Do
End If
Loop
' Close the StreamWriter object.
writer.Close()
Catch
End Try
End If
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|