Valhalla Legends Archive

Programming => General Programming => .NET Platform => Topic started by: peoman on September 11, 2006, 01:34 PM

Title: [VB.NET] Datagridview add new row
Post by: peoman on September 11, 2006, 01:34 PM
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)
Title: Re: [VB.NET] Datagridview add new row
Post by: MyndFyre on September 11, 2006, 04:32 PM
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.
Title: Re: [VB.NET] Datagridview add new row
Post by: peoman on September 14, 2006, 02:20 AM
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?