BindingSource

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
 
M

Miro

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?
 
V

Vasco

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top