I am trying to populate a datagridview with rows obtained from a file.
The file has rows broken up by a semi-colon. The information i need populated in the cells of the datagridview are the values after the semicolon.
What my program does is read the lines of the code. Then i am trying to remove from the input string all the values to the left of the semi-colon and then inputting that value into the datagridview row. For some reason VB is telling me to create an instance of a "new" object. I am not seeing why however.
DataGridView1.Rows.Add() 'ROW ADDED
varcount = DataGridView1.Rows.Count 'MAX ROWS OF DATAGRIDVIEW
For xvar As Integer = 0 To 5 'LOOP INPUT FILE
Dim line 'STRING CONTAINING INPUT
Dim pos As Integer 'POSITION OF SEMI-COLON
line = sr.ReadLine 'READS LINE
pos = InStr(line, "; ") 'GETS POSITION OF SEMI-COLON
varstr = line.Remove(0, pos) '>>>>>ERROR HERE<<<<<
DataGridView1.Rows(varcount - 1).Cells(xvar).Value = varstr 'INPUT COLUMN CELLS