Hi ppl. Im a bit of a newbee when it comes to coding but having a problem adding a text file to a listview box. My code sort of works as far as putting data in the first collum goes.
// Set variables
int collum = 0;
int arraySize = 0;
// Read codes.txt in to codeNew
FileStream codeNew = File.Open("C:\\codes.txt", FileMode.Open, FileAccess.Read);
StreamReader codeRead = new StreamReader(codeNew);
string codeView = codeRead.ReadToEnd();
// release variables
codeRead.Close();
codeNew.Close();
//Capture parts of codes.txt between the * and put into array
String[] codeArray = codeView.Split(new char[] { '*' });
//Put contents of array into three collum listview1
do
{
string code = codeArray[collum];
listView1.Items.Add(code);
code = codeArray[collum + 1];
listView1.Items.subItems.add(code);
code = codeArray[collum + 2];
listView1.Items.subItems.add(code);
collum = collum + 3;
arraySize=arraySize +3;
} while (arraySize < (codeArray.Length));
The red bits are whats giving me errors. I have similar lines of code earlier in my proggy that works but here I get error "System.Windows.Forms.ListView' does not contain a definition for 'subitems'"
can someone tell me what im doing wrong or how to add the data to collums 2 and 3 please?
eg of codes.txt:
collum1*collum2*collum3*collum1*collum2*collum3*collum1*collum2*collum3 etc.