How to initialise data bound fields for entry of a new record

  • Thread starter Thread starter Joshua Ellul
  • Start date Start date
J

Joshua Ellul

Hi There,

Could someone tell me how I could initialise my dataset for entry of a new
record, so that the data bound text boxes would be cleared?

Josh
 
Setup and Binding is done as follows:

Dim SqlStr As String = "SELECT * FROM Persons"

myCon = New OleDb.OleDbConnection(DBStr)
myAdapter = New OleDb.OleDbDataAdapter(SqlStr, myCon)
myAdapter.Fill(myDS, "Persons")

Dim myBuilder As New OleDb.OleDbCommandBuilder(myAdapter)
myAdapter.UpdateCommand = myBuilder.GetUpdateCommand
myAdapter.InsertCommand = myBuilder.GetInsertCommand
myAdapter.DeleteCommand = myBuilder.GetDeleteCommand
myCon.Close()

txtFirstName.DataBindings.Add("text", myDS, "Persons.FirstName")


Then to create a new record:
Me.BindingContext(myDS, "Persons").AddNew()

Any ideas?

Josh
 
Back
Top