Cornelis96
Gebruiker
- Lid geworden
- 22 mrt 2010
- Berichten
- 107
Ik heb een Sub gemaakt om een ListviewItem naar een String te COnverteren dit is de Code
en 1 voor een hele ListView
ik gebruik de onderste maar krijg een fout in de bovenste De fout
Code:
Public Function Listviewitemtostring(ByVal ListVIewitem As ListViewItem, ByRef kolommen As String) As String
Dim File As String = Nothing
Dim tlrk As Integer
Do While tlrk < kolommen
If 0 = tlrk Then
File = ListVIewitem.Text & vbTab
ElseIf tlrk = kolommen - 1 Then
File = File & ListVIewitem.SubItems(tlrk - 1).Text
Else
File = File & ListVIewitem.SubItems(tlrk - 1).Text & vbTab
End If
tlrk = tlrk + 1
Loop
Listviewitemtostring = File
End Function
Code:
Public Function listviewtoString(ByVal listview As ListView) As String
Dim Text As String = Nothing
Dim tlr As Integer
Do While listview.Items.Count > tlr
If tlr = listview.Items.Count - 1 Then
Text = Text & Listviewitemtostring(listview.Items(tlr), listview.Columns.Count)
Else
End If
tlr = tlr + 1
Loop
listviewtoString = Text
End Function
Code:
An unhandled exception of type 'System.ArgumentOutOfRangeException' occurred in System.Windows.Forms.dll
Additional information: InvalidArgument=Value of '1' is not valid for 'index'.
Laatst bewerkt: