| | |
GridView Add row
Please support our VB.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Apr 2008
Posts: 75
Reputation:
Solved Threads: 0
I have bind the DataGridview with DB. To add the data from textboxes to DataGrid, I use the foll. code-
Error is coming
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound
there is no any way to add data to the Gridview if we bound it to the Database.
VB.NET Syntax (Toggle Plain Text)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Try Dim row0 As String() = {TextBox1.Text, TextBox2.Text, TextBox3.Text} DataGridView1.Rows.Add(row0) row0 = Nothing Catch ex As Exception MsgBox(ex.Message) End Try End Sub
Error is coming
Rows cannot be programmatically added to the DataGridView's rows collection when the control is data-bound
there is no any way to add data to the Gridview if we bound it to the Database.
•
•
Join Date: Sep 2009
Posts: 289
Reputation:
Solved Threads: 38
0
#2 32 Days Ago
The DataGridView control is simply a means of displaying data from an underlying datasource such as a DataSet/DataTable/Array etc.... You do not want to add rows directly to the DataGridView, you want to add rows to the underlying datasource. Such as if you have a datatable attached, it is the datatable you want to add a row too.
![]() |
Similar Threads
- Add New Row When Focus On Last Column (C#)
- VBNET 2003 Add new row into DataSet (Python)
- im getting problem with gridview (Community Introductions)
- Change the color of gridview row when the row is selected.. (ASP.NET)
- Add row dynamically to an HTML table (JavaScript / DHTML / AJAX)
- Regarding add new row in the Table. (JavaScript / DHTML / AJAX)
- Add a new Row in a datagridview which is binded to a datatable (C#)
- How to add a new row to a datagrid (C#)
- DataGridView in Winforms using C# (C#)
Other Threads in the VB.NET Forum
- Previous Thread: Strange Behavior With DataGridview Control...
- Next Thread: how to do this
| Thread Tools | Search this Thread |
.net .net2008 2008 access account advanced application array basic beginner browser button buttons center click code combo cuesent data database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic excel exists fade filter forms generatetags gridview html images input insert intel internet listview map mobile module monitor msaccess net number objects open panel passingparameters pdf picturebox picturebox2 port position print printing problem regex right-to-left save search searchvb.net select serial settings shutdown socket sqldatbase sqlserver survey table temperature textbox timer timespan transparency txttoxmlconverter update user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vba vbnet visual visualbasic visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





