Help adding datagridview row
Private
MessageBox.Show("File should be CSV with no quotes in following format: name,emailaddress,faxnumber,sendemail,sendfax")
ofd1.ShowDialog() My text file is as follows test1,test@bentest.com,01422556665,1,1 The code throws an exception "object not set to instance of an object" on the line However I wont let me dim the dgcell using new keyword "arrays cannot be declared with new", even taking the array out it says "new cannot be used on a class that mustinherit" Can anyone help? Thanks.
Dim fnameAsString = ofd1.FileName
Dim srAs System.IO.StreamReader = System.IO.File.OpenText(fname)
DoUntil sr.Peek = -1
Dim lineAsString = sr.ReadLine()
Dim arrItems()AsString = Split(line,",")
Dim dgrowAsNew DataGridViewRow
Dim dgcell(5)As DataGridViewCell
Dim aAsInteger
Dim bAsInteger = arrItems.Length
For a = 0To b
dgcell(a).Value = arrItems(a)
dgrow.Cells.Add(dgcell(a))
Next
dgAddContacts.Rows.Add(dgrow)
Loop
EndSub
test2,blah@somewhere.com,01152212211,1,1
testing3,sdfsadf@dfdf.com,445652254,1,1
test4,test@benddtest.com,01dd422556665,1,1
test5,ssdasd@sds.com,87897979,1,1
dgcell(a).Value = arrItems(a)

