Home All Groups Group Topic Archive Search About
Author
3 May 2010 11:23 PM
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

Author
5 May 2010 1:42 PM
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?

Show quoteHide quote
"Vasco" <Va***@discussions.microsoft.com> wrote in message
news:4A426B74-4F43-46E8-96E8-3C470DF9768E@microsoft.com...
> 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
Author
5 May 2010 3:48 PM
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.


Show quoteHide quote
"Miro" wrote:

> 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?
>
> "Vasco" <Va***@discussions.microsoft.com> wrote in message
> news:4A426B74-4F43-46E8-96E8-3C470DF9768E@microsoft.com...
> > 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
>
> .
>