Я пытаюсь заполнить вид DataGrid с содержимым афа текстового файла я использовал следующий код:строка не может быть программно добавлена
Private Sub Button15_Click(sender As Object, e As EventArgs) _
Handles Button15.Click
'strPath is the location of text file
Dim lines = (From line In IO.File.ReadAllLines(strPath)
Select line.Split(CChar(vbTab))).ToArray
For x As Integer = 0 To lines(0).GetUpperBound(0)
dgQuotation.Columns.Add(lines(0)(x), lines(0)(x))
Next
For x As Integer = 1 To lines.GetUpperBound(0)
dgQuotation.Rows.Add(lines(x))
Next
End Sub
Но каждый раз, когда я запустить программу я получаю следующее время работы ошибка:
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound.
Помогите, я новичок в VB. Заранее спасибо.
Вы должны добавить новые строки/строки в источник данных представления datagrid. – Jade