Re: Help with listview items
try this:
vb Code:
Private Sub btnimp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnimp.Click
Dim items() As ListViewItem = lstvicon.SelectedItems.Cast(Of ListViewItem).ToArray
Dim csv() As String = Array.ConvertAll(items, Function(lvi) String.Join(",", lvi.SubItems.Cast(Of ListViewItem.ListViewSubItem).Select(Function(si) si.Text).ToArray))
IO.File.WriteAllLines("C:\Documents and Settings\Software\Ambiente de trabalho\cv7import\teste.csv", csv)
End Sub
Re: Help with listview items
damn that works perfectly!! thanks a lot.
Can you also help me on making the names be converted into short name? The format i really wanted was around this :
movieprograms : moviep~1
This being on the csv. Do you have any idea if this is possible?
Re: Help with listview items
here's an api function that gives you a short path from a file path:
vb Code:
Public Class Form1
Declare Function GetShortPathName Lib "kernel32" _
Alias "GetShortPathNameA" (ByVal lpszLongPath As String, _
ByVal lpszShortPath As String, ByVal cchBuffer As Integer) As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim shortPath As New String(" "c, 256)
GetShortPathName("long path here", shortPath, 256)
MsgBox(shortPath.Trim)
End Sub
End Class