robert_anisoiu
Jun 12th, 2009, 02:39 AM
Hi,
In a mobile application I need to read from a .txt file and fill with information a ListView Control. I don't know why a receive an error.
The code is below:
Dim StreamReader As IO.StreamReader
Dim line As String
StreamReader = New IO.StreamReader("Smart Card\fisier.txt")
While StreamReader.Peek <> -1
line = StreamReader.ReadLine()
ListView1.Items.Add(line)
End While
The error message is in "ListView1.Items.Add(line)"; "Error 1 Value of type 'String' cannot be converted to 'System.Windows.Forms.ListViewItem'.
The .txt file contain first name and given name separated by a space and I want to display the list of names in a ListView Control.
Can anybody help me?
Thank you,
Robert
In a mobile application I need to read from a .txt file and fill with information a ListView Control. I don't know why a receive an error.
The code is below:
Dim StreamReader As IO.StreamReader
Dim line As String
StreamReader = New IO.StreamReader("Smart Card\fisier.txt")
While StreamReader.Peek <> -1
line = StreamReader.ReadLine()
ListView1.Items.Add(line)
End While
The error message is in "ListView1.Items.Add(line)"; "Error 1 Value of type 'String' cannot be converted to 'System.Windows.Forms.ListViewItem'.
The .txt file contain first name and given name separated by a space and I want to display the list of names in a ListView Control.
Can anybody help me?
Thank you,
Robert