Valhalla Legends Forums Archive | .NET Platform | [VB.NET] Datagridview add new row

AuthorMessageTime
peoman
Newbie problem

I'm trying to create a new row to a datagridview.
I want to get the values of the cells from textboxes.
Everything i have tried, i always get this message:
"Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound."

Any help???

I also want to be able to search in the datagrid.
How can i "select a row" when the index of a cell is equal or contains letters from a textbox?Huh

(I hope you can understand my english)
September 11, 2006, 6:34 PM
Myndfyr
Sounds like you shouldn't be trying to add rows after the control is databound.  You programatically data bind the control.  So look into that.
September 11, 2006, 9:32 PM
peoman
I'm trying to use Suspend/Resume Binding like this:

DataGridView1.BindingContext(AuthorsDataSet, "authors").SuspendBinding()
DataGridView1.Rows.Add(New String() {"1", "2"})
DataGridView1.BindingContext(AuthorsDataSet, "authors").ResumeBinding()

but i still can't create a new row. What am i doing wrong?
September 14, 2006, 7:20 AM

Search