BindingSource

  • Thread starter Thread starter Vasco
  • Start date Start date
V

Vasco

You cannot vote on your own post
0

Hello,

I use a master/detail form, where records are shown. this form was created
in VB 2010, using the design tools of VS. When i select add on
BindingNavigator, the bound controls clear, as expected.

The behaviour i need is the opposite. Like that i can create a new record,
based on the last one.
Any suggestion?

thanks
 
I am not quite sure if I understand what you are asking for.

You want to "Default" the current record with the prior record?

Is that what you are looking for?
 
i want to create a new record, based on the values of another record.

basixally i want to copy records.

anyway, i managed to find a solution:

If Me.G01BindingSource.Current IsNot Nothing Then
Dim drvOld As DataRowView =
DirectCast(Me.G01BindingSource.Current, DataRowView)
Dim drvNew As DataRowView =
DirectCast(Me.G01BindingSource.AddNew(), DataRowView)
For Each dc As DataColumn In drvNew.Row.Table.Columns
If Not dc.ReadOnly AndAlso Not dc.AutoIncrement Then 'Don't
try to overwrite a ReadOnly or AutoIncrement column.
drvNew.Row(dc) = drvOld.Row(dc)
End If
Next dc

Me.G01BindingSource.ResetBindings(False)
End If

G01_BindindSource refers to main table. Process is similar to child table.
 
Back
Top