int position = this.BindingContext[this.oOrder.GetCurrentDataSet(), this.oOrder.TableName].Position;In VB .NET:
Dim position As Integer = Me.BindingContext(Me.oOrder.GetCurrentDataSet(), Me.oOrder.TableName).Position2. You can then pass the business object and position to the child form. For example:
ChildForm form = new ChildForm(this.oOrder, position); form.ShowDialog();In VB .NET:
Dim form As New ChildForm(Me.oOrder, position) form.ShowDialog()3. In the constructor of the child form, you can register the passed business object, issue BindAllControls(), and then set the specified position.
public ChildForm(Orders orders, int position) { // Register the orders business object this.RegisterBizObj(orders); // // Required for Windows Form Designer support // InitializeComponent(); // Bind all user interface controls this.BindAllControls(); // Set the position to that of the parent form this.BindingContext[orders.GetCurrentDataSet(),orders.TableName].Position = position; }In VB .NET:
Public Sub New(orders As Orders, position As Integer) ' Register the orders business object Me.RegisterBizObj(orders) ' ' Required for Windows Form Designer support ' InitializeComponent() ' Bind all user interface controls Me.BindAllControls() ' Set the position to that of the parent form Me.BindingContext(orders.GetCurrentDataSet(), orders.TableName).Position = position End SubAlternately, you could simply put a new instance of the Orders business object on the child form and retrieve the current row when the form instantiates. When working with am MM .NET DataGrid on the parent form, (as you pointed out) you can get the PK of the current row by means of the DataGrid's GetCurrentRowPK() method. You could pass this as a parameter to the child form.