Re: Datagridview not editing
Post the error, and code of what you've tried. It's easier to bind controls than not, but you can also NOT update a record. It depends on what you've done so far...
Re: Datagridview not editing
using the following code I initialise my grid
gird is filled, I want user to edit the columns, could add new rows, delete exisiting one.
Grid is editable, but not reflected into the database
Dim dt1 As New DataTable, adptr1 As New SqlDataAdapter ' declared at class objects
Private Sub InitializeDataGridView()
Try
' Set up the DataGridView.
With Me.DataGridView2
' Automatically generate the DataGridView columns.
.AutoGenerateColumns = True
cmdobj.CommandType = CommandType.Text
cmdobj.CommandText = "select * fromauthors"
adptr1.SelectCommand = cmdobj : adptr1.Fill(dt1)
BindingSource1.DataSource = dt1
DataGridView2.DataSource = BindingSource1 '.Tab
' Automatically resize the visible rows.
.AutoSizeRowsMode = _
DataGridViewAutoSizeRowsMode.DisplayedCellsExceptHeaders
' Set the DataGridView control's border.
.BorderStyle = BorderStyle.Fixed3D
' Put the cells in edit mode when user enters them.
.EditMode = DataGridViewEditMode.EditOnEnter
End With
Catch ex As SqlException
MessageBox.Show(ex.Tomessage)
System.Threading.Thread.CurrentThread.Abort()
End Try
End Sub
Re: Datagridview not editing
This should do it:
Code:
DataGridView2.DataSource = String.Empty
Re: Datagridview not editing
Dear lienna
where to set this property?, string.empty
kindly give me a tutorial, the mechanism of editing and reflecting to
underlying tables of datagridview