Hi Duke Carey,
For your question how to not allow use edit the field. I would place these textboxes in a panel and set the panel’s Enabledto false when I don’t want to allow the users edit the field.
I didn’t quite get your second question. If you mean you want to ask the use to commit the changes to the database when the current row has been changed, you can check RowState of current row, if it is not RowState.Unchanged, write back to the database.
Code Block
If currentDataRow.RowState <> DataRowState.Unchanged Then
'do update stuff here
End If
If you mean you don’t want to write back to the underlying data source unless the user clicks on the commit button, you can set the DataSourceUpdateMode to false DataSourceUpdateMode.Never of Binding object and call the WriteValue method in the commit button click handler.
Code Block
'set the DataSourceUpdateMode to DataSourceUpdateMode.Never
Me.textBox1.DataBindings.Add("Text", dt, "col", True, DataSourceUpdateMode.Never)
Private Sub btnCommit_Click(ByVal sender As Object, ByVal e As EventArgs)
'write back to the underlying data source
Me.textBox1.DataBindings("Text").WriteValue()
End Sub
Hope this helps.
Best regards.
Rong-Chun Zhang